Closed PavithranRick closed 7 months ago
I think because you create new Adapter on every increment? Singleton is summoned by calling a method who determine to create new object or not
This issue is stale because it has been open 30 days with no activity.
i think this is explained here: https://github.com/nodeshift/opossum/issues/593
Am trying to implement a circuit breaker in node js as a singleton class using https://nodeshift.dev/opossum/ For some reason, breaker metrics always start from 0 and the circuit never opens after the threshold failure.
REF: https://github.com/nodeshift/opossum/issues/593 -> The author seems to suggest using closure to achieve singleton property but doesn't work for me. Any reason why or pointers I can check?
Node.js Version: v18.15.0
Operating System: Darwin C02G540YMD6R 22.2.0 Darwin Kernel Version 22.2.0: Fri Nov 11 02:08:47 PST 2022; root:xnu-8792.61.2~4/RELEASE_X86_64 x86_64
Steps to Produce Error: https://filebin.net/zbjhntvjnqwdobns (download and use the command (npm install && node src/singleton.js) to run it locally)
singleton.js
handler-wrapper.js
circuit-breaker.js
adapter.js