* Add a default 30s timeout for `delayShutdownMs`
`settings.delayShutdownMs` doesn't seem to be defined anywhere
Logs typically often this pair of entries:
```
INFO 2024-11-21T15:51:42.115Z [resource.labels.containerName: filestore] received interrupt, cleaning up
INFO 2024-11-21T15:51:42.120Z [resource.labels.containerName: filestore] shutdown timed out, exiting
```
This indicates that there is no delay between the interrupt signal and the shutdown. The 100ms delay also doesn't happen. We believe that the `server.close` callback is called after `server.closeAllConnections()`, and the `server closed` log is usually lost because of the process exiting immediately.
See: https://cloudlogging.app.goo.gl/WJQ6mc3gWwotVQya7
* Add timeout before exiting
* Replace `delayShutdownMs` by `gracefulShutdownDelayInMs`.
Looks like the error came from a wrong merge in https://github.com/overleaf/internal/pull/18756
We don't want a default 30s timeout for the shutdown, per https://github.com/overleaf/internal/pull/16888
GitOrigin-RevId: c1bdc8986f78a6e18e8b8b1fe60b33aa6ffef909
* Add `unicorn/prefer-node-protocol`
* Fix `unicorn/prefer-node-protocol` ESLint errors
* Run `npm run format:fix`
* Add sandboxed-module sourceTransformers in mocha setups
Fix `no such file or directory, open 'node:fs'` in `sandboxed-module`
* Remove `node:` in the SandboxedModule requires
* Fix new linting errors with `node:`
GitOrigin-RevId: 68f6e31e2191fcff4cb8058dd0a6914c14f59926
* Set `node-fetch` to `^2.7.0`
* Update package-lock.json
```
# root
bin/npm update node-fetch
bin/npm update cross-fetch
# in other path in docker
npm update node-fetch
```
* Update node-fetch patch
* [fetch-utils] Skip the test: destroys the request body if it doesn't get consumed
```
1) fetch-utils
fetchJson
destroys the request body if it doesn't get consumed:
FetchError: Invalid response body while trying to fetch http://example.com:30001/json/ignore-request: write EPIPE
at PassThrough.<anonymous> (/overleaf/node_modules/node-fetch/lib/index.js:400:12)
at PassThrough.emit (node:events:529:35)
at emitErrorNT (node:internal/streams/destroy:151:8)
at emitErrorCloseNT (node:internal/streams/destroy:116:3)
at process.processTicksAndRejections (node:internal/process/task_queues:82:21)
```
* [fetch-utils] Delete the test: destroys the request body if it doesn't get consumed
* Remove the `setTimeout` in the node-fetch patch
Fixes a test and doesn't break filestore acceptance tests
* Update node-fetch patch again: bring changes from e87b093/src/index.js
* Update node-fetch patch again: bring changes from e87b093/src/index.js
* Update node-fetch patches back to single lines
Per https://github.com/overleaf/internal/pull/20165#discussion_r1739035513
GitOrigin-RevId: 945e5a12e838673b7bc87b588b7aca1bcd9109e2
* Update `@google-cloud/storage` and remove its patches
* Re-add patch on `@google-cloud/storage/retry-request`
Replace mentions of `.pipe()` and run `patch-package @google-cloud/storage/retry-request`
It was very hard to test whether the package could still cause bugs, so I'd rather put the patch back
GitOrigin-RevId: be83b54b6d55849995ac131bfcf3c9acd9b6dd8e
* Add some JSDoc types to `@overleaf/logger`
* Update `logger.error` calls
* Fixup `logger.err` JSDoc
* Update `logger.err` calls
* Fix `args` type
* Remove "Error message" description
* Replace `arguments` by actual arguments of the method
* Fix: "ESLint: Unnecessary '.apply()'.(no-useless-call)"
* Add JSDoc params to `debug` `info` `warn`
* Remove extra `args` param in JSDoc so developers aren't invited to use it
Not sure if this is the best thing to do because it creates a warning in the IDE: "Parameter args is not described in JSDoc"
* Add comment about serialization of `err` `req` `res`
* Allow strings as first param in `debug` `info` `warn`
* Fix syntax for optional parameters in JSDoc
* Add 2 signatures, to avoid "string, string" params
* Fix `@signature` names copy-pastes
Co-authored-by: Jakob Ackermann <jakob.ackermann@overleaf.com>
* Revert the double `@param attributes`. It doesn't work
---------
Co-authored-by: Jakob Ackermann <jakob.ackermann@overleaf.com>
GitOrigin-RevId: 086dee8bbf30d577c5e1f844a9df5e518c46aca7