@vercel/functions 3.9.2 → 3.9.5

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/CHANGELOG.md CHANGED
@@ -1,5 +1,25 @@
1
1
  # @vercel/functions
2
2
 
3
+ ## 3.9.5
4
+
5
+ ### Patch Changes
6
+
7
+ - 282f1c0: Use the current invocation deadline when waiting for database pool idle timers.
8
+
9
+ ## 3.9.4
10
+
11
+ ### Patch Changes
12
+
13
+ - @vercel/oidc@3.8.5
14
+
15
+ ## 3.9.3
16
+
17
+ ### Patch Changes
18
+
19
+ - 2da7809: Remove redundant and ineffective package tests.
20
+ - Updated dependencies [2da7809]
21
+ - @vercel/oidc@3.8.4
22
+
3
23
  ## 3.9.2
4
24
 
5
25
  ### Patch Changes
@@ -23,6 +23,7 @@ __export(db_connections_exports, {
23
23
  });
24
24
  module.exports = __toCommonJS(db_connections_exports);
25
25
  var import_get_context = require("../get-context");
26
+ var import_deadline = require("../deadline");
26
27
  const DEBUG = !!process.env.DEBUG;
27
28
  function getIdleTimeout(dbPool) {
28
29
  if ("options" in dbPool && dbPool.options) {
@@ -58,7 +59,6 @@ function getIdleTimeout(dbPool) {
58
59
  let idleTimeout = null;
59
60
  let idleTimeoutResolve = () => {
60
61
  };
61
- const bootTime = Date.now();
62
62
  const maximumDuration = 15 * 60 * 1e3 - 1e3;
63
63
  function waitUntilIdleTimeout(dbPool) {
64
64
  if (!process.env.VERCEL_URL || // This is not set during builds where we don't need to wait for idle connections using the mechanism
@@ -72,9 +72,11 @@ function waitUntilIdleTimeout(dbPool) {
72
72
  const promise = new Promise((resolve) => {
73
73
  idleTimeoutResolve = resolve;
74
74
  });
75
+ const deadline = (0, import_deadline.getDeadline)();
76
+ const remainingDuration = deadline ? deadline.getTime() - Date.now() - 1e3 : maximumDuration;
75
77
  const waitTime = Math.min(
76
78
  getIdleTimeout(dbPool) + 100,
77
- Math.max(100, maximumDuration - (Date.now() - bootTime))
79
+ Math.max(100, remainingDuration)
78
80
  );
79
81
  idleTimeout = setTimeout(() => {
80
82
  idleTimeoutResolve?.();
@@ -6,7 +6,7 @@
6
6
 
7
7
  > **attachDatabasePool**(`dbPool`): `void`
8
8
 
9
- Defined in: [packages/functions/src/db-connections/index.ts:225](https://github.com/vercel/vercel/blob/main/packages/functions/src/db-connections/index.ts#L225)
9
+ Defined in: [packages/functions/src/db-connections/index.ts:230](https://github.com/vercel/vercel/blob/main/packages/functions/src/db-connections/index.ts#L230)
10
10
 
11
11
  **`Experimental`**
12
12
 
@@ -6,7 +6,7 @@
6
6
 
7
7
  > `const` **experimental\_attachDatabasePool**: (`dbPool`) => `void` = `attachDatabasePool`
8
8
 
9
- Defined in: [packages/functions/src/db-connections/index.ts:323](https://github.com/vercel/vercel/blob/main/packages/functions/src/db-connections/index.ts#L323)
9
+ Defined in: [packages/functions/src/db-connections/index.ts:328](https://github.com/vercel/vercel/blob/main/packages/functions/src/db-connections/index.ts#L328)
10
10
 
11
11
  **`Experimental`**
12
12
 
package/package.json CHANGED
@@ -30,7 +30,7 @@
30
30
  "require": "./middleware.js"
31
31
  }
32
32
  },
33
- "version": "3.9.2",
33
+ "version": "3.9.5",
34
34
  "repository": {
35
35
  "directory": "packages/functions",
36
36
  "type": "git",
@@ -77,7 +77,7 @@
77
77
  "access": "public"
78
78
  },
79
79
  "dependencies": {
80
- "@vercel/oidc": "3.8.3"
80
+ "@vercel/oidc": "3.8.5"
81
81
  },
82
82
  "scripts": {
83
83
  "pretest": "pnpm run build:code",