-
-
Notifications
You must be signed in to change notification settings - Fork 11
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
Add async worker for populating DB #45
Comments
@rashadg1030 Let's have Regarding implementing the worker, I have some suggestions: Implement a separate function that fetches data for a single repo or for a single issue. In this case we will be able to test such functions from GHCi and check the data in SQL tables. And it's easy to call such functions for all fetched repos. |
@rashadg1030 I'm going to describe a high-level overview of the sync algorithm. Main function should look like this: syncCache = forever $ syncWithGitHub `catch` \... So we are trying to sync cache in the infinite loop, handling all errors.
syncWithGitHub = do
repos <- fetchAllRepos
upsertRepos
populateCategoriesAsync <- async $ populateCategories repos
issues <- fetchAllIssues
upsertIssues issues
wait populateCategoriesAsync The idea is the following:
Does this make sense for now? |
@chshersh This is perfect. Thank you! |
@chshersh Now that everything is in place, I'm gonna implement the sync algorithm for issues and then clear this issue. There will be a single function that syncs both repos and issues. |
@chshersh
|
I was wondering if it is a good time to work on the async worker that will populate our DB? Once we get a better idea of the data we need I guess. I've implemented an endpoint for our server that touches the DB and everything, so I think this would be a good next step. And one thing about file structure. We have a file that holds the GitHub query functions on the path
src/IW/Server/Search.hs
. Is it fine if it goes into theServer
folder like it is now, or should it go to another folder calledAsync
orWorker
. For example, it could besrc/IW/Worker/Search.hs
. I'm not sure because technicallySearch.hs
does function on the server, but I think files insrc/IW/Server
should be related to theissue-wanted
API.The text was updated successfully, but these errors were encountered: