@codefresh-io/eventbus 1.3.3 → 1.4.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/Store.js +2 -1
- package/lib/index.js +4 -3
- package/package.json +1 -1
package/lib/Store.js
CHANGED
|
@@ -21,6 +21,7 @@ class Store extends EventEmitter {
|
|
|
21
21
|
this.database = options.database;
|
|
22
22
|
this.user = options.user;
|
|
23
23
|
this.password = options.password;
|
|
24
|
+
this.port = options.port;
|
|
24
25
|
this.readyPromise = new Promise((resolve, reject) => {
|
|
25
26
|
this.readyDeferred = {
|
|
26
27
|
resolve: () => {
|
|
@@ -46,7 +47,7 @@ class Store extends EventEmitter {
|
|
|
46
47
|
database: this.database,
|
|
47
48
|
password: this.password,
|
|
48
49
|
host: this.host,
|
|
49
|
-
port:
|
|
50
|
+
port: this.port,
|
|
50
51
|
max: 10,
|
|
51
52
|
idleTimeoutMillis: 30000, // how long a client is allowed to remain idle before being closed
|
|
52
53
|
};
|
package/lib/index.js
CHANGED
|
@@ -88,7 +88,7 @@ class EventBus extends EventEmitter {
|
|
|
88
88
|
}
|
|
89
89
|
|
|
90
90
|
_emitReady() {
|
|
91
|
-
if (this.busReady
|
|
91
|
+
if (this.busReady) {
|
|
92
92
|
this.readyDeferred.resolve();
|
|
93
93
|
debug('ready');
|
|
94
94
|
this.emit('ready');
|
|
@@ -99,9 +99,10 @@ class EventBus extends EventEmitter {
|
|
|
99
99
|
return Promise.resolve()
|
|
100
100
|
.then(async () => {
|
|
101
101
|
await this.readyPromise;
|
|
102
|
-
await this.store.save(eventName, msg);
|
|
103
102
|
await this.bus.publish(eventName, msg);
|
|
104
|
-
})
|
|
103
|
+
}).then(() => {
|
|
104
|
+
this.store.save(eventName, msg);
|
|
105
|
+
})
|
|
105
106
|
}
|
|
106
107
|
|
|
107
108
|
subscribe(eventName, handler, options) {
|