()
| 7 | import { appConfig } from "@/src/configs/app-config.ts"; |
| 8 | |
| 9 | async function main() { |
| 10 | let exitCode = 0; |
| 11 | let redisClient: ReturnType<typeof getRedisClient> | undefined; |
| 12 | |
| 13 | try { |
| 14 | await connectMongoDB(); |
| 15 | redisClient = getRedisClient(`${appConfig.appSlug}-full-sync`); |
| 16 | |
| 17 | const probot = createProbot({ overrides: { log: logger } }); |
| 18 | await fullSync(probot, { |
| 19 | redisClient, |
| 20 | getRepositorySchedule, |
| 21 | }); |
| 22 | } catch (error) { |
| 23 | logger.error(error, "Error during full sync"); |
| 24 | exitCode = 1; |
| 25 | } finally { |
| 26 | await disconnectMongoDB(); |
| 27 | if (redisClient) { |
| 28 | try { |
| 29 | await redisClient.quit(); |
| 30 | } catch { |
| 31 | // ignore |
| 32 | } |
| 33 | } |
| 34 | Deno.exit(exitCode); |
| 35 | } |
| 36 | } |
| 37 | |
| 38 | if (import.meta.main) { |
| 39 | await main(); |
no test coverage detected