@remit/backend 0.0.140 → 0.0.142
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.
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import assert from "node:assert/strict";
|
|
2
|
+
import type { Server } from "node:http";
|
|
3
|
+
import { after, before, it } from "node:test";
|
|
4
|
+
import { UPSTREAM_KEEPALIVE_IDLE_TIMEOUT_SECONDS } from "@remit/apisix/route-table";
|
|
5
|
+
|
|
6
|
+
let server: Server;
|
|
7
|
+
|
|
8
|
+
before(async () => {
|
|
9
|
+
process.env.BETTER_AUTH_SECRET = "a-signing-secret-of-at-least-32-characters";
|
|
10
|
+
process.env.CORS_ALLOWED_ORIGINS = "https://mail.example.com";
|
|
11
|
+
process.env.SERVER_PORT = "0";
|
|
12
|
+
server = (await import("./server.js")).listener;
|
|
13
|
+
});
|
|
14
|
+
|
|
15
|
+
after(async () => {
|
|
16
|
+
await new Promise<void>((resolve) => server.close(() => resolve()));
|
|
17
|
+
});
|
|
18
|
+
|
|
19
|
+
it("keeps an idle socket open longer than the APISIX upstream pool does", () => {
|
|
20
|
+
assert.ok(
|
|
21
|
+
server.keepAliveTimeout > UPSTREAM_KEEPALIVE_IDLE_TIMEOUT_SECONDS * 1_000,
|
|
22
|
+
`backend keepAliveTimeout ${server.keepAliveTimeout}ms must exceed APISIX idle_timeout ${UPSTREAM_KEEPALIVE_IDLE_TIMEOUT_SECONDS}s`,
|
|
23
|
+
);
|
|
24
|
+
});
|
package/dev-server/server.ts
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@remit/backend",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.142",
|
|
4
4
|
"description": "Remit Mail Inspector API backend",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"author": "",
|
|
@@ -54,6 +54,7 @@
|
|
|
54
54
|
"serve": "node --import tsx dev-server/server.ts"
|
|
55
55
|
},
|
|
56
56
|
"devDependencies": {
|
|
57
|
+
"@remit/apisix": "*",
|
|
57
58
|
"@types/better-sqlite3": "^7.6.13",
|
|
58
59
|
"@types/express": "^5.0.3",
|
|
59
60
|
"@types/swagger-ui-express": "^4.1.8",
|
package/src/handlers/sync.ts
CHANGED
|
@@ -57,9 +57,7 @@ export const triggerSyncSafe = async (
|
|
|
57
57
|
// POST /sync asks for a sync of this account by name — the refresh
|
|
58
58
|
// control, pull-to-refresh, and the client's automatic poll all land
|
|
59
59
|
// here — so it syncs every mailbox regardless of how recently one
|
|
60
|
-
// ran.
|
|
61
|
-
// gate's window, so this branch cannot be driven faster than the
|
|
62
|
-
// gate would allow.
|
|
60
|
+
// ran.
|
|
63
61
|
explicitRequest: true,
|
|
64
62
|
});
|
|
65
63
|
deps.logger.info(
|