Giter Site home page Giter Site logo

Comments (13)

mhart avatar mhart commented on June 13, 2024

Bizarre error! But have reproduced no problem, thanks.

I'll look into it!

from kinesalite.

mhart avatar mhart commented on June 13, 2024

Oh right – I see, it's because you're trying to reuse the same kinesalite instance.

If you change this so that you create a new kinesalite instance each time it should work fine.

I'm not entirely sure that trying to reuse an instance once it's been closed should be a supported feature – it would mean hacking into the listen method and re-initializing the levelup database, etc – and listen isn't really a synonym for open so I don't think this is semantically correct.

I'll definitely make the error reporting a little nicer though.

from kinesalite.

rclark avatar rclark commented on June 13, 2024

Yeah the use-case is slightly odd, but common if you're using kinesalite in tests and you want to start fresh between individual tests.

I've been running tests like this with dynalite for some time, reusing the same instance. Is there a difference there?

from kinesalite.

mhart avatar mhart commented on June 13, 2024

@rclark there isn't a difference as of architect/dynalite#30

The problem is that close really should close everything, including the database – this is especially important when using an on-disk leveldb instance. To re-open the database, you need to create a new instance.

from kinesalite.

mhart avatar mhart commented on June 13, 2024

Didn't realise that a patch release would break this use case, so sorry about that! Problem is it's exploiting a bug that existed in the first place 😸

from kinesalite.

rclark avatar rclark commented on June 13, 2024

Problem is it's exploiting a bug that existed in the first place

Totally fair. I guess it wouldn't be possible to detect and explicitly fail on reuse unless you hijack the listen method?

from kinesalite.

mhart avatar mhart commented on June 13, 2024

Yep, that's what I'm doing 👍

from kinesalite.

mhart avatar mhart commented on June 13, 2024

Going with Instance has been closed, please create a new instance to listen again – sound ok?

from kinesalite.

mhart avatar mhart commented on June 13, 2024

Now that I'm looking at patching listen... I mean... I'm considering just recreating the store... 😈

I'll give it a quick test, and if it works maybe I'll just do it... If there are issues down the track with it, then can look at throwing an error instead.

from kinesalite.

mhart avatar mhart commented on June 13, 2024

Ok – so the only issue I've run into is with the 0 millisecond timeouts you're using on your create stream calls, etc.

Basically, I use setTimeout no matter what – so even with a 0 millisecond timeout, it can try to read/write after the database has closed.

I'm considering that a separate issue which I might try to patch

from kinesalite.

mhart avatar mhart commented on June 13, 2024

Ok, so I relented 😸 – you should be able to keep using it as-is. Hopefully I haven't opened a can of worms! Don't really think so though...

from kinesalite.

mhart avatar mhart commented on June 13, 2024

Released as v1.4.3

from kinesalite.

mhart avatar mhart commented on June 13, 2024

Also fixed in dynalite, released as v0.11.3 – thanks for the report!

from kinesalite.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.