@jcbuisson/express-x-client 2.2.0 → 2.2.1

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.
Files changed (2) hide show
  1. package/package.json +1 -1
  2. package/src/index.mjs +6 -4
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@jcbuisson/express-x-client",
3
- "version": "2.2.0",
3
+ "version": "2.2.1",
4
4
  "type": "module",
5
5
  "description": "Client library for ExpressX framework",
6
6
  "main": "src/index.mjs",
package/src/index.mjs CHANGED
@@ -91,10 +91,12 @@ export default function expressXClient(socket, options={}) {
91
91
  const promise = new Promise((resolve, reject) => {
92
92
  waitingPromisesByUid[uid] = [resolve, reject]
93
93
  // a timeout may also reject the promise
94
- setTimeout(() => {
95
- delete waitingPromisesByUid[uid]
96
- reject(`Error: timeout on service '${name}', action '${action}', args: ${JSON.stringify(args)}`)
97
- }, serviceOptions.timeout)
94
+ if (serviceOptions.timeout && !serviceOptions.volatile) {
95
+ setTimeout(() => {
96
+ delete waitingPromisesByUid[uid]
97
+ reject(`Error: timeout on service '${name}', action '${action}', args: ${JSON.stringify(args)}`)
98
+ }, serviceOptions.timeout)
99
+ }
98
100
  })
99
101
  // send request to server through websocket
100
102
  if (options.debug) console.log('client-request', uid, name, action, args)