Skip to content

Commit 333d619

Browse files
authored
Merge pull request #11 from hackmdio/fix/use-timeout-for-worker-interval
fix/lower worker timeout & use timeout as interval
2 parents 21ec17e + 02b476b commit 333d619

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/api.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,7 @@ export class Api {
109109
* After this timeout, a new worker will pick up the task
110110
* @todo rename this variable
111111
*/
112-
this.redisWorkerTimeout = number.parseInt(env.getConf('redis-task-timeout') || '600000')
112+
this.redisWorkerTimeout = number.parseInt(env.getConf('redis-task-timeout') || '1000')
113113
/**
114114
* Minimum lifetime of y* update messages in redis streams.
115115
*/
@@ -357,7 +357,7 @@ export class Worker {
357357
try {
358358
const tasks = await client.consumeWorkerQueue(opts)
359359
if (tasks.length === 0 || (client.redisMinMessageLifetime > time.getUnixTime() + timeDiff - number.parseInt(tasks[0].id.split('-')[0]))) {
360-
await promise.wait(client.redisMinMessageLifetime / 2)
360+
await promise.wait(client.redisWorkerTimeout)
361361
}
362362
} catch (e) {
363363
console.error(e)

0 commit comments

Comments
 (0)