I have an app that requires a "requester" module after a function call. After the use of that module, I need to delete it, because after importing it starts sending requests to a saas provider continuously, and 'delete require.cache' doesn't stop the unknown process of sending a request every second to that saas provider.
const call = async () => {
let requester = require('../utils/requester.js')
let data = await requester.get('data')
// I'm trying to delete requester like that
delete require.cache[require.resolve('../utils/requester.js')]
// Not sure if it works because the side effect of calling the saas provider remains.
}
How can I find and kill all the processes related to an imported module?