Skip to content

Commit

Permalink
fix(authorization): jobs not being processed correctly (#841)
Browse files Browse the repository at this point in the history
  • Loading branch information
kkopanidis committed Dec 10, 2023
1 parent d2c957e commit 80f4e64
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 2 deletions.
9 changes: 8 additions & 1 deletion modules/authorization/src/controllers/queue.controller.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,15 @@ export class QueueController {
const processorFile = path.normalize(
path.join(__dirname, '../jobs', 'constructRelationIndex.js'),
);
new Worker('authorization-index-queue', processorFile, {
const worker = new Worker('authorization-index-queue', processorFile, {
connection: this.redisConnection,
// autorun: true,
});
worker.on('completed', (job: any) => {
ConduitGrpcSdk.Logger.info(`Job ${job.id} completed`);
});
worker.on('error', (error: any) => {
ConduitGrpcSdk.Logger.info(`Job error:`, error);
});
}

Expand Down
3 changes: 2 additions & 1 deletion modules/authorization/src/jobs/constructRelationIndex.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,9 @@ type ConstructRelationIndexWorkerData = {
module.exports = async (job: SandboxedJob<ConstructRelationIndexWorkerData>) => {
const { relations } = job.data;
if (!process.env.CONDUIT_SERVER) throw new Error('No serverUrl provided!');
const grpcSdk = new ConduitGrpcSdk(process.env.CONDUIT_SERVER, 'authorization');
const grpcSdk = new ConduitGrpcSdk(process.env.CONDUIT_SERVER, 'authorization', false);
await grpcSdk.initialize();
await grpcSdk.initializeEventBus();
await grpcSdk.waitForExistence('database');
ObjectIndex.getInstance(grpcSdk.database!);
ActorIndex.getInstance(grpcSdk.database!);
Expand Down

0 comments on commit 80f4e64

Please sign in to comment.