You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@couchdb.apache.org by GitBox <gi...@apache.org> on 2020/04/27 20:50:53 UTC

[GitHub] [couchdb-couch-dbupdates] nickva edited a comment on pull request #3: background deletion for soft-deleted database

nickva edited a comment on pull request #3:
URL: https://github.com/apache/couchdb-couch-dbupdates/pull/3#issuecomment-618490073


   @jiangphcn we chatted on slack but I'll summarize some of that just for visibility
   
   For `error:badarg` we just need to find a way a better way to wait for couch_jobs to initialize there. Maybe call `application:which_applications/1` or try to get he list of children from `couch_jobs_sup`.
   
   For the general execution pattern it would be something like:
   
   `init()` : respond back to ensure initialization proceeds, then call `wait_for_couch_jobs()`
   
   `wait_for_couch_jobs()` :
     - wait for couch_jobs to initialize and either get the cleanup job, or try to add it, then call `run_loop()`
   
   `run_loop()`:
     - call `couch_jobs:accept()` and wait for job
     - once it gets a job it calls `process_expirations()` 
     - when it returns calls couch_jobs:resubmit(..., ScheduledTime = Now + 1hour)
     - call run_loop() recursively
   
   `process_expirations()`:
      - go through all the dbs
      - periodically update the jobs state, (We could have stats there like `accept_time`, `last_update_time`, `scheduled_time`, `dbs_processed`, `dbs_deleted`, etc...)
       
   
    


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org