-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: implement syncRepositories cron job
- Loading branch information
1 parent
e5192ae
commit 6ede990
Showing
4 changed files
with
26 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,4 @@ | ||
// export all your job files here | ||
|
||
export * from "./examples"; | ||
export * from "./sync-repositories"; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
import { cronTrigger } from "@trigger.dev/sdk"; | ||
import { client } from "@/trigger"; | ||
import repositoryService from "@/services/repository.service"; | ||
|
||
client.defineJob({ | ||
id: "sync-repositories-job", | ||
name: "Sync Repositories Job", | ||
version: "0.0.1", | ||
|
||
trigger: cronTrigger({ | ||
cron: "30 02 * * *", | ||
}), | ||
|
||
run: async (payload, io, ctx) => { | ||
await io.runTask("sync-repositories", async () => { | ||
return repositoryService.syncRepositories(); | ||
}); | ||
|
||
await io.logger.info("✨ Sync Repositories Job"); | ||
}, | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters