diff --git a/CHANGELOG.md b/CHANGELOG.md index da864e9fcf..1657813855 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -97,6 +97,7 @@ Changes before Tatum release are not documented in this file. #### Fixed - Fix operator flag voting behavior when using custom gas estimation (https://github.com/streamr-dev/network/pull/2784) +- Fix a bug causing the inspection process to freeze (https://github.com/streamr-dev/network/pull/2893) #### Security diff --git a/packages/node/src/plugins/operator/inspectOverTime.ts b/packages/node/src/plugins/operator/inspectOverTime.ts index e88b7c9557..edf61c2b59 100644 --- a/packages/node/src/plugins/operator/inspectOverTime.ts +++ b/packages/node/src/plugins/operator/inspectOverTime.ts @@ -117,6 +117,7 @@ class InspectionOverTimeTask { destroy(): void { this.abortController.abort() + this.doneGate.open() } private async run(): Promise { diff --git a/packages/node/test/unit/plugins/operator/inspectOverTime.test.ts b/packages/node/test/unit/plugins/operator/inspectOverTime.test.ts new file mode 100644 index 0000000000..4cc0e3150e --- /dev/null +++ b/packages/node/test/unit/plugins/operator/inspectOverTime.test.ts @@ -0,0 +1,33 @@ +import { randomDhtAddress } from '@streamr/dht' +import { randomEthereumAddress } from '@streamr/test-utils' +import { StreamPartIDUtils } from '@streamr/utils' +import { inspectOverTime } from '../../../../src/plugins/operator/inspectOverTime' + +describe('inspectOverTime', () => { + + it('getRedundancyFactor() rejects (NET-1377)', async () => { + const task = inspectOverTime({ + target: { + sponsorshipAddress: randomEthereumAddress(), + operatorAddress: randomEthereumAddress(), + streamPart: StreamPartIDUtils.parse('stream#0') + }, + streamrClient: undefined as any, + createOperatorFleetState: () => ({ + getNodeIds: () => [randomDhtAddress()], + start: async () => {}, + waitUntilReady: () => Promise.resolve(), + destroy: async () => {} + } as any), + getRedundancyFactor: () => Promise.reject(new Error('mock-error')), + delayBeforeFirstInspectionInMs: 0, + heartbeatTimeoutInMs: 0, + inspectionIntervalInMs: 1000, + maxInspectionCount: 1, + waitUntilPassOrDone: true, + abortSignal: new AbortController().signal, + traceId: '' + }) + await expect(task()).resolves.toEqual([]) + }) +})