I have a custom module that returns an array of keys ( I need all keys in local_keys that are not in current_keys.)
Both input arrays are ~150k records.
It works, but is blocking other requests during the 30 seconds it takes to run. I don’t care about the 30 seconds as this is run in the background, but I do care that it is blocking user http requests.
I can’t find any documentation on how to get array’s into custom modules, so I am stringifying the arrays, and then parsing them out, which is the root problem I believe, not the filter.
exports.keys_to_remove = async function (options) {
let current_keys = JSON.parse(this.parseRequired(options.current_keys, 'string', 'parameter current_keys is required.'));
let local_keys = JSON.parse(this.parseRequired(options.local_keys, 'string', 'parameter local_keys is required.'));
return local_keys.filter(x => !current_keys.includes(x));
};
Anybody have ideas on a better way to do this?
Edit: The problem is NOT in the parsing of the arrays, it IS the filter. Although there must be a way to accept arrays.
Community Page
Last updated:
Last updated: