MCPcopy Create free account
hub / github.com/datalust/seq-logging / _ship

Method _ship

seq_logger.js:154–178  ·  view source on GitHub ↗

* * @returns {Promise }

()

Source from the content-addressed store, hash-verified

152 * @returns {Promise<boolean>}
153 */
154 _ship() {
155 if (this._queue.length === 0) {
156 return Promise.resolve(false);
157 }
158
159 let wait = this._activeShipper || Promise.resolve(false);
160 let shipper = this._activeShipper = wait
161 .then(() => {
162 let more = drained => {
163 if (drained) {
164 // If the queue was drained, let the timer
165 // push us forwards.
166 return true;
167 }
168 return this._sendBatch().then(d => more(d));
169 }
170 return this._sendBatch().then(drained => more(drained));
171 })
172 .then(() => this._reset(shipper), e => {
173 this._onError(e);
174 this._reset(shipper);
175 });
176
177 return shipper;
178 }
179
180 _sendBatch() {
181 if (this._queue.length === 0) {

Callers 2

flushMethod · 0.95
_onTimerMethod · 0.95

Calls 2

_sendBatchMethod · 0.95
_resetMethod · 0.95

Tested by

no test coverage detected