@fedify/mysql 2.2.0 → 2.3.0-dev.1013
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/dist/mq.cjs +18 -0
- package/dist/mq.d.cts +6 -1
- package/dist/mq.d.ts +6 -1
- package/dist/mq.js +18 -0
- package/package.json +4 -4
package/dist/mq.cjs
CHANGED
|
@@ -170,6 +170,24 @@ var MysqlMessageQueue = class {
|
|
|
170
170
|
});
|
|
171
171
|
}
|
|
172
172
|
/**
|
|
173
|
+
* {@inheritDoc MessageQueue.getDepth}
|
|
174
|
+
* @since 2.3.0
|
|
175
|
+
*/
|
|
176
|
+
async getDepth() {
|
|
177
|
+
await this.initialize();
|
|
178
|
+
const [rows] = await this.#pool.query(`SELECT
|
|
179
|
+
COUNT(*) AS queued,
|
|
180
|
+
COALESCE(SUM(\`deliver_after\` <= NOW(6)), 0) AS ready
|
|
181
|
+
FROM \`${this.#tableName}\``);
|
|
182
|
+
const queued = Number(rows[0].queued);
|
|
183
|
+
const ready = Number(rows[0].ready);
|
|
184
|
+
return {
|
|
185
|
+
queued,
|
|
186
|
+
ready,
|
|
187
|
+
delayed: Math.max(0, queued - ready)
|
|
188
|
+
};
|
|
189
|
+
}
|
|
190
|
+
/**
|
|
173
191
|
* {@inheritDoc MessageQueue.listen}
|
|
174
192
|
* @since 2.1.0
|
|
175
193
|
*/
|
package/dist/mq.d.cts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { MessageQueue, MessageQueueEnqueueOptions, MessageQueueListenOptions } from "@fedify/fedify";
|
|
1
|
+
import { MessageQueue, MessageQueueDepth, MessageQueueEnqueueOptions, MessageQueueListenOptions } from "@fedify/fedify";
|
|
2
2
|
|
|
3
3
|
//#region src/mq.d.ts
|
|
4
4
|
interface MysqlQueryable {
|
|
@@ -113,6 +113,11 @@ declare class MysqlMessageQueue implements MessageQueue {
|
|
|
113
113
|
*/
|
|
114
114
|
enqueueMany(messages: readonly any[], options?: MessageQueueEnqueueOptions): Promise<void>;
|
|
115
115
|
/**
|
|
116
|
+
* {@inheritDoc MessageQueue.getDepth}
|
|
117
|
+
* @since 2.3.0
|
|
118
|
+
*/
|
|
119
|
+
getDepth(): Promise<MessageQueueDepth>;
|
|
120
|
+
/**
|
|
116
121
|
* {@inheritDoc MessageQueue.listen}
|
|
117
122
|
* @since 2.1.0
|
|
118
123
|
*/
|
package/dist/mq.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { Temporal } from "@js-temporal/polyfill";
|
|
2
|
-
import { MessageQueue, MessageQueueEnqueueOptions, MessageQueueListenOptions } from "@fedify/fedify";
|
|
2
|
+
import { MessageQueue, MessageQueueDepth, MessageQueueEnqueueOptions, MessageQueueListenOptions } from "@fedify/fedify";
|
|
3
3
|
|
|
4
4
|
//#region src/mq.d.ts
|
|
5
5
|
interface MysqlQueryable {
|
|
@@ -114,6 +114,11 @@ declare class MysqlMessageQueue implements MessageQueue {
|
|
|
114
114
|
*/
|
|
115
115
|
enqueueMany(messages: readonly any[], options?: MessageQueueEnqueueOptions): Promise<void>;
|
|
116
116
|
/**
|
|
117
|
+
* {@inheritDoc MessageQueue.getDepth}
|
|
118
|
+
* @since 2.3.0
|
|
119
|
+
*/
|
|
120
|
+
getDepth(): Promise<MessageQueueDepth>;
|
|
121
|
+
/**
|
|
117
122
|
* {@inheritDoc MessageQueue.listen}
|
|
118
123
|
* @since 2.1.0
|
|
119
124
|
*/
|
package/dist/mq.js
CHANGED
|
@@ -170,6 +170,24 @@ var MysqlMessageQueue = class {
|
|
|
170
170
|
});
|
|
171
171
|
}
|
|
172
172
|
/**
|
|
173
|
+
* {@inheritDoc MessageQueue.getDepth}
|
|
174
|
+
* @since 2.3.0
|
|
175
|
+
*/
|
|
176
|
+
async getDepth() {
|
|
177
|
+
await this.initialize();
|
|
178
|
+
const [rows] = await this.#pool.query(`SELECT
|
|
179
|
+
COUNT(*) AS queued,
|
|
180
|
+
COALESCE(SUM(\`deliver_after\` <= NOW(6)), 0) AS ready
|
|
181
|
+
FROM \`${this.#tableName}\``);
|
|
182
|
+
const queued = Number(rows[0].queued);
|
|
183
|
+
const ready = Number(rows[0].ready);
|
|
184
|
+
return {
|
|
185
|
+
queued,
|
|
186
|
+
ready,
|
|
187
|
+
delayed: Math.max(0, queued - ready)
|
|
188
|
+
};
|
|
189
|
+
}
|
|
190
|
+
/**
|
|
173
191
|
* {@inheritDoc MessageQueue.listen}
|
|
174
192
|
* @since 2.1.0
|
|
175
193
|
*/
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@fedify/mysql",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.3.0-dev.1013+4aa6a88c",
|
|
4
4
|
"description": "MySQL/MariaDB drivers for Fedify",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"fedify",
|
|
@@ -75,13 +75,13 @@
|
|
|
75
75
|
},
|
|
76
76
|
"peerDependencies": {
|
|
77
77
|
"mysql2": "^3.18.0",
|
|
78
|
-
"@fedify/fedify": "^2.
|
|
78
|
+
"@fedify/fedify": "^2.3.0-dev.1013+4aa6a88c"
|
|
79
79
|
},
|
|
80
80
|
"devDependencies": {
|
|
81
81
|
"tsdown": "^0.21.6",
|
|
82
82
|
"typescript": "^5.9.2",
|
|
83
|
-
"@fedify/
|
|
84
|
-
"@fedify/
|
|
83
|
+
"@fedify/testing": "^2.3.0-dev.1013+4aa6a88c",
|
|
84
|
+
"@fedify/fixture": "^2.0.0"
|
|
85
85
|
},
|
|
86
86
|
"scripts": {
|
|
87
87
|
"build:self": "tsdown",
|