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

Trigger sync without calling sync_api after login #671

Closed
sssoleileraaa opened this issue Dec 18, 2019 · 4 comments · Fixed by #739
Closed

Trigger sync without calling sync_api after login #671

sssoleileraaa opened this issue Dec 18, 2019 · 4 comments · Fixed by #739

Comments

@sssoleileraaa
Copy link
Contributor

Description

Since we want our background process to sync every 15 seconds or so (exact number of seconds TBD) and for it to be the only area of code that creates a MetadataSyncJob, we will need to remove this line of code:

Instead we should restart the thread that periodically syncs with the server so that a MetadataSyncJob is immediately run. This helps ensure that MetadataSyncJob is only ever created in one place and only one at a time.

@sssoleileraaa sssoleileraaa changed the title Speed up sync on_authentication Trigger sync without calling sync_api after login Dec 18, 2019
@eloquence
Copy link
Member

Is this blocked on #652 or can it be done before then?

@sssoleileraaa
Copy link
Contributor Author

correct

@ntoll
Copy link
Contributor

ntoll commented Jan 23, 2020

Removing this line means that upon application start, and after logging in, the user doesn't see any sources. I suggest we definitely want to sync_api on login so the user gets an accurate and up-to-date state of what's on the server.

(I'm probably missing something here)

@sssoleileraaa
Copy link
Contributor Author

The idea is to simplify our metadata sync code so that we have a continuous background thread that runs a MetadataSyncJob every X seconds. Currently we call sync_api all over the place and are trying to remove this. Instead when a user logs in, the metadata sync thread should start the background process of making calls to get metadata from the server. When the user logs out we should stop this thread. So it's just one thread, one loop, if the MetadataSyncJob fails it pauses the main and download queues, and keeps trying every X seconds (we may want to ramp down on retries in the future). When it succeeds, it resumes the queues.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants