()
| 15 | } |
| 16 | |
| 17 | processQueue() { |
| 18 | if (this.isProcessing || this.queue.length === 0) { |
| 19 | return; |
| 20 | } |
| 21 | this.isProcessing = true; |
| 22 | const { query, callback, queryId } = this.queue.shift(); |
| 23 | this.execute(query) |
| 24 | .then(result => callback(null, queryId, result)) |
| 25 | .catch(error => callback(error, queryId)) |
| 26 | .finally(() => { |
| 27 | this.isProcessing = false; |
| 28 | this.processQueue(); |
| 29 | }); |
| 30 | } |
| 31 | |
| 32 | async execute(query) { |
| 33 | if (query.toLowerCase().startsWith('select')) { |