senecajs-labs / seneca-shard-store

Sharding for Seneca
MIT License
4 stars 6 forks source link

Infinite loop with updated dependencies #7

Closed vtardia closed 9 years ago

vtardia commented 9 years ago

In current version, with seneca 0.5.20, code like this makes sense:

for (var shardId in specification.shards) {
     var shard = specification.shards[shardId]
     shard.seneca = seneca
     shard.seneca.use(shard.store.plugin, shard.store.options)
}

Every shard has its own seneca instance that uses its specific store and can be called with shard.seneca.act(args, cb) in store-specific methods (load, save, etc).

By updating dependencies and using seneca 0.7.1 the same code generates an infinite loop. The seneca instance attached to each shard does not use that shard's specific store, it uses the highest level shard-store, so each call to shard.seneca.act(args, cb) recalls itself recursively.

Is there a way to address a specific store with the act() method?

paolochiodi commented 9 years ago

I'm not able to reproduce this anymore. I think the problem was that the seneca initialisation was inside a before function in the test. As part of moving the tests to lab I've already moved that out (see https://github.com/senecajs/seneca-shard-store/pull/12).

Another possible cause is the presence of seneca-store-test at versione 1.0.0 during your tests. Current implementation of shard-store has another serious problem with that versions (see #11)