account-lookup-service 17.11.0-snapshot.0 → 17.11.0

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
@@ -2,6 +2,13 @@
2
2
 
3
3
  All notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines.
4
4
 
5
+ ## [17.11.0](https://github.com/mojaloop/account-lookup-service/compare/v17.10.3...v17.11.0) (2025-07-07)
6
+
7
+
8
+ ### Features
9
+
10
+ * **csi-1604:** used ha timeout design with redlock impl ([#556](https://github.com/mojaloop/account-lookup-service/issues/556)) ([17a2477](https://github.com/mojaloop/account-lookup-service/commit/17a24779fb39b09ee535cd908f4f30ab45e57a8e))
11
+
5
12
  ### [17.10.3](https://github.com/mojaloop/account-lookup-service/compare/v17.10.2...v17.10.3) (2025-06-24)
6
13
 
7
14
 
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "account-lookup-service",
3
3
  "description": "Account Lookup Service is used to validate Party and Participant lookups.",
4
- "version": "17.11.0-snapshot.0",
4
+ "version": "17.11.0",
5
5
  "license": "Apache-2.0",
6
6
  "author": "ModusBox",
7
7
  "contributors": [
@@ -95,7 +95,7 @@
95
95
  "@mojaloop/central-services-health": "15.1.0",
96
96
  "@mojaloop/central-services-logger": "11.9.0",
97
97
  "@mojaloop/central-services-metrics": "12.6.0",
98
- "@mojaloop/central-services-shared": "18.29.0-snapshot.0",
98
+ "@mojaloop/central-services-shared": "18.29.0",
99
99
  "@mojaloop/central-services-stream": "11.8.0",
100
100
  "@mojaloop/database-lib": "11.2.0",
101
101
  "@mojaloop/event-sdk": "14.6.1",
@@ -44,17 +44,19 @@ let distLock
44
44
  const timeout = async (options) => {
45
45
  if (isRunning) return
46
46
  const { logger } = options
47
+ let isAcquired = false
47
48
 
48
49
  try {
49
50
  isRunning = true
50
- if (!await distLock?.acquireLock()) return
51
+ isAcquired = await distLock?.acquireLock()
52
+ if (!isAcquired) return
51
53
  await TimeoutService.timeoutInterschemePartiesLookups(options)
52
54
  await TimeoutService.timeoutProxyGetPartiesLookups(options)
53
55
  logger.verbose('ALS timeout handler is done')
54
56
  } catch (err) {
55
57
  logger.error('error in timeout: ', err)
56
58
  } finally {
57
- await distLock?.releaseLock()
59
+ if (isAcquired) await distLock.releaseLock()
58
60
  isRunning = false
59
61
  }
60
62
  }
@@ -88,7 +90,7 @@ const register = async (options) => {
88
90
  const stop = async () => {
89
91
  if (isRegistered) {
90
92
  await timeoutJob.stop()
91
- // await distLock?.releaseLock()
93
+ await distLock?.releaseLock()
92
94
  isRegistered = false
93
95
  }
94
96
  }
package/src/lib/config.js CHANGED
@@ -162,7 +162,6 @@ const config = {
162
162
  HANDLERS_TIMEOUT_TIMEXP: RC.HANDLERS.TIMEOUT.TIMEXP,
163
163
  HANDLERS_TIMEOUT_TIMEZONE: RC.HANDLERS.TIMEOUT.TIMEZONE,
164
164
  HANDLERS_TIMEOUT_BATCH_SIZE: RC.HANDLERS.TIMEOUT.BATCH_SIZE,
165
- HANDLERS_TIMEOUT_DIST_LOCK_ENABLED: RC.HANDLERS.TIMEOUT?.DIST_LOCK?.enabled,
166
165
  ERROR_HANDLING: RC.ERROR_HANDLING,
167
166
  SWITCH_ENDPOINT: RC.SWITCH_ENDPOINT,
168
167
  INSTRUMENTATION_METRICS_DISABLED: RC.INSTRUMENTATION.METRICS.DISABLED,
@@ -84,7 +84,7 @@ describe('TimeoutHandler', () => {
84
84
  await TimeoutHandler.stop()
85
85
  })
86
86
 
87
- it('should execute timout service', async () => {
87
+ it('should execute timeout service', async () => {
88
88
  await TimeoutHandler.register(mockOptions)
89
89
  jest.spyOn(TimeoutService, 'timeoutInterschemePartiesLookups').mockResolvedValue()
90
90
  await TimeoutHandler.timeout(mockOptions)
@@ -93,7 +93,6 @@ describe('TimeoutHandler', () => {
93
93
 
94
94
  it('should not run if isRunning is true (distLock disabled)', async () => {
95
95
  await TimeoutHandler.register(mockOptions)
96
- Config.HANDLERS_TIMEOUT_DIST_LOCK_ENABLED = false
97
96
  jest.spyOn(TimeoutService, 'timeoutInterschemePartiesLookups').mockImplementation(async () => {
98
97
  await wait(1000)
99
98
  })
@@ -124,7 +123,7 @@ describe('TimeoutHandler', () => {
124
123
  await TimeoutHandler.timeout(mockOptions)
125
124
 
126
125
  expect(mockDistLock.acquire).toHaveBeenCalledTimes(1)
127
- expect(mockDistLock.release).toHaveBeenCalled() // todo: think if we need .release() to have been called
126
+ expect(mockDistLock.release).not.toHaveBeenCalled()
128
127
  expect(TimeoutService.timeoutProxyGetPartiesLookups).not.toHaveBeenCalled()
129
128
  })
130
129
  })