@codefresh-io/eventbus
Advanced tools
Comparing version
@@ -36,12 +36,15 @@ 'use strict'; | ||
async quit() { | ||
try { | ||
await Promise.all([this.bus.quit(), this.store.quit()]); | ||
this.emit('quit'); | ||
} catch (err) { | ||
throw new CFError({ | ||
cause: err, | ||
message: 'Failed during quit execution' | ||
quit() { | ||
return Promise.resolve() | ||
.then(async () => { | ||
try { | ||
await Promise.all([this.bus.quit(), this.store.quit()]); | ||
this.emit('quit'); | ||
} catch (err) { | ||
throw new CFError({ | ||
cause: err, | ||
message: 'Failed during quit execution' | ||
}); | ||
} | ||
}); | ||
} | ||
} | ||
@@ -96,11 +99,17 @@ | ||
async publish(eventName, msg) { | ||
await this.readyPromise; | ||
await this.store.save(eventName, msg); | ||
await this.bus.publish(eventName, msg); | ||
publish(eventName, msg) { | ||
return Promise.resolve() | ||
.then(async () => { | ||
await this.readyPromise; | ||
await this.store.save(eventName, msg); | ||
await this.bus.publish(eventName, msg); | ||
}); | ||
} | ||
async subscribe(eventName, handler, subService) { | ||
await this.readyPromise; | ||
return await this.bus.subscribe(eventName, handler, subService); | ||
subscribe(eventName, handler, subService) { | ||
return Promise.resolve() | ||
.then(async () => { | ||
await this.readyPromise; | ||
return await this.bus.subscribe(eventName, handler, subService); | ||
}); | ||
} | ||
@@ -113,5 +122,8 @@ | ||
*/ | ||
async getAllAggregateEvents(aggregateId, fromIndex) { | ||
await this.readyPromise; | ||
return await this.store.getAllAggregateEvents(aggregateId, fromIndex); | ||
getAllAggregateEvents(aggregateId, fromIndex) { | ||
return Promise.resolve() | ||
.then(async () => { | ||
await this.readyPromise; | ||
return await this.store.getAllAggregateEvents(aggregateId, fromIndex); | ||
}); | ||
} | ||
@@ -124,5 +136,8 @@ | ||
*/ | ||
async getAllEventsByName(name, fromIndex) { | ||
await this.readyPromise; | ||
return await this.store.getAllEventsByName(name, fromIndex); | ||
getAllEventsByName(name, fromIndex) { | ||
return Promise.resolve() | ||
.then(async () => { | ||
await this.readyPromise; | ||
return await this.store.getAllEventsByName(name, fromIndex); | ||
}); | ||
} | ||
@@ -129,0 +144,0 @@ |
{ | ||
"name": "@codefresh-io/eventbus", | ||
"version": "0.0.16", | ||
"version": "0.0.17", | ||
"description": "", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
URL strings
Supply chain riskPackage contains fragments of external URLs or IP addresses, which the package may be accessing at runtime.
Found 1 instance in 1 package
URL strings
Supply chain riskPackage contains fragments of external URLs or IP addresses, which the package may be accessing at runtime.
Found 1 instance in 1 package
150334
0.35%666
2.3%