00016_--_arch_design.txt 1.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940
  1. Q: what about qeueuing?
  2. A: yes
  3. Several operations may finish slowly, so they have to be queued. At the heart
  4. there is a wait job queue with one file for each job still due.
  5. app/var/spool/jobs/wait/2023-03-13T012345Z.5abf8.12.job
  6. The date is the time until which th job is postponed, hash is over the unique job properties, the number is
  7. how many tries there have been before. The file content is immutable.
  8. Retries double the waiting time each time and timeout after one week. Starting
  9. with a 1-minute wait that's 13 tries.
  10. Example calculation: Advertise a post to 10k followers - doing 10k sequential
  11. jobs each taking 2s is 20ks or 5.5h.
  12. The queue health (it should be all empty) is displayed as part of the housekeeping
  13. Web UI. File counts, time slots for wait.
  14. Queue processing is triggered by
  15. - loop until no more job in new
  16. - sleeping forks (until next one)
  17. - logged in web interaction
  18. - endpoint with auth token (monitoring)
  19. There should not be more than 1 sleeping fork, however => app/var/lock/job
  20. Only jobs entering err log an INFO.
  21. Q: How to ensure loss-safe retries? How/where to store retry counter?
  22. http://cr.yp.to/proto/maildir.html
  23. - in the filename? duplicate jobs possible
  24. - in the job? otherwise unchanged payload rewrites and timing issues.
  25. API evtl. https://salmon-mail.readthedocs.io/en/latest/_modules/salmon/queue.html