Software: Apache/2.4.41 (Ubuntu). PHP/8.0.30 uname -a: Linux apirnd 5.4.0-204-generic #224-Ubuntu SMP Thu Dec 5 13:38:28 UTC 2024 x86_64 uid=33(www-data) gid=33(www-data) groups=33(www-data) Safe-mode: OFF (not secure) /var/www/html/proxy_server/node_modules/sequelize/lib/dialects/mssql/ drwxr-xr-x | |
| Viewing file: Select action/file-type: 'use strict';
const BaseError = require('../../errors/base-error');
const ConnectionError = require('../../errors/connection-error');
/**
* Thrown when a connection to a database is closed while an operation is in progress
*/
class AsyncQueueError extends BaseError {
constructor(message) {
super(message);
this.name = 'SequelizeAsyncQueueError';
}
}
exports.AsyncQueueError = AsyncQueueError;
class AsyncQueue {
constructor() {
this.previous = Promise.resolve();
this.closed = false;
this.rejectCurrent = () => {};
}
close() {
this.closed = true;
this.rejectCurrent(new ConnectionError(new AsyncQueueError('the connection was closed before this query could finish executing')));
}
enqueue(asyncFunction) {
// This outer promise might seems superflous since down below we return asyncFunction().then(resolve, reject).
// However, this ensures that this.previous will never be a rejected promise so the queue will
// always keep going, while still communicating rejection from asyncFunction to the user.
return new Promise((resolve, reject) => {
this.previous = this.previous.then(
() => {
this.rejectCurrent = reject;
if (this.closed) {
return reject(new ConnectionError(new AsyncQueueError('the connection was closed before this query could be executed')));
}
return asyncFunction().then(resolve, reject);
}
);
});
}
}
exports.default = AsyncQueue;
|
:: Command execute :: | |
--[ c99shell v. 2.5 [PHP 8 Update] [24.05.2025] | Generation time: 0.0159 ]-- |