File tree Expand file tree Collapse file tree 5 files changed +11
-17
lines changed Expand file tree Collapse file tree 5 files changed +11
-17
lines changed Original file line number Diff line number Diff line change @@ -26,7 +26,7 @@ const dominator = {
2626
2727let debugMode = false ;
2828
29- dominator . initialize = function ( ) {
29+ dominator . initialize = async function ( ) {
3030 if ( debugMode ) console . log ( "dominator.initialize" , this )
3131
3232 const self = this ;
@@ -43,12 +43,8 @@ dominator.initialize = function () {
4343 }
4444
4545 // Then, ensure an index is set
46-
47- if ( self . collection . createIndex ) {
48- self . collection . createIndexAsync ( { serverId : 1 } , { unique : 1 } ) ;
49- } else {
50- self . collection . _ensureIndex ( { serverId : 1 } , { unique : 1 } ) ;
51- }
46+ await self . collection . createIndexAsync ( { serverId : 1 } , { unique : 1 } ) ;
47+
5248
5349 // Finally, set the serverId
5450 self . serverId = Utilities . config . getServerId ( ) ;
Original file line number Diff line number Diff line change @@ -4,8 +4,8 @@ import { manager } from "./manager/"
44
55const Operator = { dominator, queue, manager }
66
7- Operator . start = function ( ) {
8- Operator . dominator . initialize ( ) ;
7+ Operator . start = async function ( ) {
8+ await Operator . dominator . initialize ( ) ;
99}
1010
1111export { Operator }
Original file line number Diff line number Diff line change @@ -5,8 +5,8 @@ import { Operator } from "../operator/"
55// 1. Wait 3 seconds for all the code to initialize
66// 2. Start Jobs if autoStart is enabled
77
8- Meteor . startup ( function ( ) {
9- Utilities . start ( ) ;
8+ Meteor . startup ( async function ( ) {
9+ await Utilities . start ( ) ;
1010 Operator . start ( ) ;
1111
1212 if ( Utilities . config . autoStart ) {
Original file line number Diff line number Diff line change @@ -3,17 +3,15 @@ import { config } from "../config"
33
44let collection ;
55
6- const initializeCollection = function ( ) {
6+ const initializeCollection = async function ( ) {
77 if ( config . remoteCollection ) {
88 const dbDriver = new MongoInternals . RemoteCollectionDriver ( config . remoteCollection ) ;
99 collection = new Mongo . Collection ( config . collectionName , { _driver : dbDriver } ) ;
1010 } else {
1111 collection = new Mongo . Collection ( config . collectionName ) ;
1212 }
1313
14- if ( collection . createIndexAsync ) {
15- collection . createIndexAsync ( { due : 1 , state : 1 } ) ;
16- }
14+ await collection . createIndexAsync ( { due : 1 , state : 1 } ) ;
1715
1816 return collection ;
1917}
Original file line number Diff line number Diff line change @@ -6,8 +6,8 @@ import { initializeCollection } from "./collection"
66
77const Utilities = { config, logger, helpers, registry }
88
9- Utilities . start = function ( ) {
10- Utilities . collection = initializeCollection ( ) ;
9+ Utilities . start = async function ( ) {
10+ Utilities . collection = await initializeCollection ( ) ;
1111 Utilities . config . started = true ;
1212}
1313
You can’t perform that action at this time.
0 commit comments