Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Recording doesn't always stop #232

Closed
eldelacajita opened this issue Jul 15, 2022 · 8 comments · Fixed by #253
Closed

Recording doesn't always stop #232

eldelacajita opened this issue Jul 15, 2022 · 8 comments · Fixed by #253
Labels
enhancement New feature or request

Comments

@eldelacajita
Copy link

Lately I've been having this issue where I click "stop" and the recording does seem to stop, but when I come back to work I find the recording had actually not stopped and is still counting.

I don't know exactly how to reproduce it, but it happens quite frequently. I'm using TimeTagger on mobile as a pinned Firefox web app, and on my PC as a GNOME Web (Epiphany) web app, but the error doens't seem to depend on having both open at the same time.

Is this happening to anyone else?

@almarklein
Copy link
Owner

My first guess is that it might be related to the sync delay. When you make a change (e.g. stop a record) the sync indicator in the top left will show a plus (indicating pending changes). It will take 3 second or so before these changes are sent to the server. If you close the app before the sync takes place, the server wont receive it. On PC the sync still happens when you select another tab or application. I'm not sure whether this is also the case on mobile.

When the app is opened again later, the change should still show, and it should sync at that moment. But if you open the app on another device first, then that change will not be there (because it has not been sent to the server yet).

Could this explain the behavior that you're seeing?

@almarklein almarklein added the question Further information is requested label Jul 15, 2022
@eldelacajita
Copy link
Author

Thanks for the reply!

I'm pretty sure this happens even if I give the app enough time to sync to the server. From now on I'm always going to check if the app has synced before closing or opening it on another location, and I will see if the issue appears again.

@almarklein
Copy link
Owner

almarklein commented Sep 7, 2022

Any news on this? If not, I'll close the issue. You can then always re-open if you confirm this as a bug in the future. I also added a note related to this issue in #233 #230.

@eldelacajita
Copy link
Author

It seems that more carefully waiting for the sync indicator to finish its cycle fixed these issues. Basically, avoiding to stop a running task and immediately close the app. So yes, you can close this 👍

@almarklein almarklein reopened this Sep 12, 2022
@almarklein
Copy link
Owner

My apologies, I somehow failed to see what's actually happening earlier:

  1. you make a change, which is applied locally to the in-memory data structure.
  2. When the sync indicator is done, it will
    a. apply the change to the persistent browser database (indexedDB)
    b. try to send the changes to the server

So if you close the browser before the sync action is performed, you indeed lose these changes.

Browsers have an API to tell it that there is "unsaved data", so that the browser can open a popup when the tab is closed. We could probably use that here.

@almarklein almarklein added enhancement New feature or request and removed question Further information is requested labels Sep 12, 2022
@eldelacajita
Copy link
Author

Oh, interesting!

Is it possible to deliver a specific message with that popup? Maybe ask the user to just wait for some seconds for sync to finish, or something like that?

@almarklein
Copy link
Owner

Is it possible to deliver a specific message with that popup?

Yes, you can specify a custom message (and the PR does that), but all modern browsers chose to ignore it 🤷

@almarklein
Copy link
Owner

I guess in theory we could make the unload callback trigger something in the app, so that it's visible in addition to the popup ...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants