first off, awesome project!
ok, heres my issue. In a service, I load an entire namespace (using the scatter-plugin-all plugin), iterate over the modules and register new modules in a new namespace depending on certain configuration. this part works as expected
// psuedo-code
scatter.load('config')
.then(config => {
scatter.load('all!workers')
.then(workers => {
return Object.keys(workers).map(name => [name, workers[name]]
})
.each(pair => {
const [name, worker] = pair
const data = { /* ... */ }
if (config.enabled[name]) {
const consumer = new Consumer(name, worker, data)
container.registerModuleInstance(`consumers/${name}`, consumer)
}
})
})
the issue is, when I then try to load all of the new namespace in another module, i receive an empty object, unless i load twice. my guess is this has something to do with the caching mechanism and the fact that the new namespace is registered after startup
container.load('all!consumers')
.then(console.log) // {}
.then(() => container.load('all!consumers'))
.then(console.log) // { 'consumers/a': Consumer, 'consumers/b': Consumer }
any ideas on what I'm doing wrong?
first off, awesome project!
ok, heres my issue. In a service, I load an entire namespace (using the
scatter-plugin-allplugin), iterate over the modules and register new modules in a new namespace depending on certain configuration. this part works as expectedthe issue is, when I then try to load all of the new namespace in another module, i receive an empty object, unless i load twice. my guess is this has something to do with the caching mechanism and the fact that the new namespace is registered after startup
any ideas on what I'm doing wrong?