feat: Concurrency control items cost compute.

This commit is contained in:
Ahmed Bouhuolia
2020-08-23 23:38:42 +02:00
parent 45088b2d3b
commit ab6bc0517f
28 changed files with 463 additions and 341 deletions

View File

@@ -1,6 +1,7 @@
import Agenda from 'agenda';
import WelcomeEmailJob from '@/Jobs/welcomeEmail';
import ComputeItemCost from '@/Jobs/ComputeItemCost';
import RewriteInvoicesJournalEntries from '@/jobs/writeInvoicesJEntries';
export default ({ agenda }: { agenda: Agenda }) => {
agenda.define(
@@ -10,8 +11,13 @@ export default ({ agenda }: { agenda: Agenda }) => {
);
agenda.define(
'compute-item-cost',
{ priority: 'high' },
{ priority: 'high', concurrency: 20 },
new ComputeItemCost().handler,
);
agenda.define(
'rewrite-invoices-journal-entries',
{ priority: 'normal', concurrency: 1, },
new RewriteInvoicesJournalEntries().handler,
);
agenda.start();
};