Created
October 22, 2021 08:01
-
-
Save galElmalah/f52c421cdec55faf595af99932347b8b to your computer and use it in GitHub Desktop.
pseudo code
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
interface Job { | |
path: string, | |
try: number // intially 0 | |
} | |
const pool = someWorkersPoolLibrary() | |
const Q = downloadAllRules() | |
while(Q.length || pool.pendingJobs) { | |
const currentJob = Q.unshift() | |
currentJob.try++ | |
pool.run('runRule', job).then(() => { | |
// rule finished running, we might report a rule error etc in this phase | |
}).catch(e => { | |
if (currentJob.try < 3) | |
Q.push(currentJob) | |
}) ; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment