Skip to content

πŸ“¨ The ultimate agentic social media scheduling tool πŸ€–

feat: sync trending

Nevo David27183220a404
diff --git a/apps/cron/src/cron.module.ts b/apps/cron/src/cron.module.ts
index 81bacd008..589d6dcf6 100644
--- a/apps/cron/src/cron.module.ts
+++ b/apps/cron/src/cron.module.ts
@@ -6,6 +6,7 @@ import { DatabaseModule } from '@gitroom/nestjs-libraries/database/prisma/databa
import { RedisModule } from '@gitroom/nestjs-libraries/redis/redis.module';
import { BullMqModule } from '@gitroom/nestjs-libraries/bull-mq-transport/bull-mq.module';
import { ioRedis } from '@gitroom/nestjs-libraries/redis/redis.service';
+import { SyncTrending } from '@gitroom/cron/tasks/sync.trending';
@Module({
imports: [
@@ -17,6 +18,6 @@ import { ioRedis } from '@gitroom/nestjs-libraries/redis/redis.service';
}),
],
controllers: [],
- providers: [RefreshTokens, CheckStars],
+ providers: [RefreshTokens, CheckStars, SyncTrending],
})
export class CronModule {}
diff --git a/apps/cron/src/tasks/sync.trending.ts b/apps/cron/src/tasks/sync.trending.ts
new file mode 100644
index 000000000..dc5a1a57f
--- /dev/null
+++ b/apps/cron/src/tasks/sync.trending.ts
@@ -0,0 +1,14 @@
+import { Injectable } from '@nestjs/common';
+import { Cron } from '@nestjs/schedule';
+import { BullMqClient } from '@gitroom/nestjs-libraries/bull-mq-transport/client/bull-mq.client';
+
+@Injectable()
+export class SyncTrending {
+ constructor(
+ private _workerServiceProducer: BullMqClient
+ ) {}
+ @Cron('0 * * * *')
+ async syncTrending() {
+ this._workerServiceProducer.emit('sync_trending', {}).subscribe();
+ }
+}