MCPcopy
hub / github.com/bee-queue/bee-queue / getEventPromise

Method getEventPromise

lib/queue.js:97–119  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

95 if (this._isReady) return resolve(this._isReady);
96
97 const getEventPromise = () => {
98 if (this.settings.getEvents || this.settings.activateDelayedJobs) {
99 return this.makeClient('eclient', true).then(() => {
100 this.eclient.on('message', this._onMessage.bind(this));
101 const channels = [];
102 if (this.settings.getEvents) {
103 channels.push(this.toKey('events'));
104 }
105 if (this.settings.activateDelayedJobs) {
106 channels.push(this.toKey('earlierDelayed'));
107 }
108 return Promise.all(
109 channels.map((channel) =>
110 helpers.callAsync((done) =>
111 this.eclient.subscribe(channel, done)
112 )
113 )
114 );
115 });
116 }
117
118 return null;
119 };
120
121 const eventsPromise = getEventPromise();
122 // Wait for Lua scripts and client connections to load. Also wait for

Callers

nothing calls this directly

Calls 3

makeClientMethod · 0.95
toKeyMethod · 0.95
onMethod · 0.80

Tested by

no test coverage detected