-
Notifications
You must be signed in to change notification settings - Fork 13
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
9920b1d
commit 91dfaa9
Showing
5 changed files
with
100 additions
and
6 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
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
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,24 @@ | ||
import { SimpleIntervalJob, Task } from 'toad-scheduler'; | ||
import { Organization } from '../models'; | ||
import dotenv from 'dotenv'; | ||
dotenv.config(); | ||
|
||
import Debug from 'debug'; | ||
Debug.enable('climate-warehouse:task:organizations'); | ||
|
||
const log = Debug('climate-warehouse:task:organizations'); | ||
|
||
const task = new Task('sync-organization-meta', () => { | ||
log('Syncing subscribed organizations'); | ||
if (process.env.USE_SIMULATOR === 'false') { | ||
Organization.syncOrganizationMeta(); | ||
} | ||
}); | ||
|
||
const job = new SimpleIntervalJob( | ||
{ days: 1, runImmediately: true }, | ||
task, | ||
'sync-organization-meta', | ||
); | ||
|
||
export default job; |