mirror of
https://github.com/cerc-io/watcher-ts
synced 2024-11-19 20:36:19 +00:00
Update pgboss queue params. (#154)
This commit is contained in:
parent
c1ef96ba2e
commit
10e7d37fa8
@ -39,6 +39,7 @@ query allEthHeaderCids($blockNumber: BigInt) {
|
||||
cid
|
||||
blockNumber
|
||||
blockHash
|
||||
parentHash
|
||||
timestamp
|
||||
ethTransactionCidsByHeaderId {
|
||||
nodes {
|
||||
@ -67,6 +68,7 @@ subscription SubscriptionReceipt {
|
||||
ethHeaderCidByHeaderId {
|
||||
blockHash
|
||||
blockNumber
|
||||
parentHash
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -82,6 +84,7 @@ subscription {
|
||||
... on EthHeaderCid {
|
||||
blockHash
|
||||
blockNumber
|
||||
parentHash
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -97,6 +100,7 @@ subscription SubscriptionHeader {
|
||||
ethHeaderCidByHeaderId {
|
||||
blockHash
|
||||
blockNumber
|
||||
parentHash
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -17,7 +17,24 @@ export class JobQueue {
|
||||
|
||||
constructor (config: Config) {
|
||||
this._config = config;
|
||||
this._boss = new PgBoss({ connectionString: this._config.dbConnectionString, onComplete: true });
|
||||
this._boss = new PgBoss({
|
||||
// https://github.com/timgit/pg-boss/blob/master/docs/configuration.md
|
||||
|
||||
connectionString: this._config.dbConnectionString,
|
||||
onComplete: true,
|
||||
|
||||
// Num of retries with backoff
|
||||
retryLimit: 15,
|
||||
retryDelay: 1,
|
||||
retryBackoff: true,
|
||||
|
||||
expireInHours: 24 * 7, // 7 days
|
||||
|
||||
retentionDays: 30, // 30 days
|
||||
|
||||
newJobCheckIntervalSeconds: 1
|
||||
});
|
||||
|
||||
this._boss.on('error', error => log(error));
|
||||
}
|
||||
|
||||
@ -30,7 +47,7 @@ export class JobQueue {
|
||||
}
|
||||
|
||||
async subscribe (queue: string, callback: JobCallback): Promise<string> {
|
||||
return await this._boss.subscribe(queue, async (job: any) => {
|
||||
return await this._boss.subscribe(queue, { teamSize: 1, teamConcurrency: 1 }, async (job: any) => {
|
||||
log(`Processing queue ${queue} job ${job.id}...`);
|
||||
await callback(job);
|
||||
});
|
||||
|
Loading…
Reference in New Issue
Block a user