Skip to content

Commit

Permalink
feat: Add interval can be set by enviroment var
Browse files Browse the repository at this point in the history
Use the INTERVAL environment variable to set the interval to check each
repository. INTERVAL is in milliseconds.
  • Loading branch information
btorresgil committed Aug 16, 2020
1 parent c5e2855 commit 0dce966
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,11 @@ import {
import { AppConfig } from './types'
import { sendMessage, hashMessage, findMessage } from './issue'

// Default interval is every 12 hours (12 * 60 * 60 * 1000 = 43200000)
const INTERVAL = parseInt(process.env.INTERVAL || '43200000')

export = (app: Application): void => {
// createScheduler(app, { interval: 7 * 24 * 60 * 60 * 1000 }) // Trigger each repo once a week
createScheduler(app, { interval: 12 * 60 * 60 * 1000 }) // Every 12 hours
createScheduler(app, { interval: INTERVAL })
app.on('schedule.repository', async (context) => {
// Don't check private or other non-relevant repos
if (!isActivePublicRepo(context)) return
Expand Down

0 comments on commit 0dce966

Please sign in to comment.