Giter VIP home page Giter VIP logo

Comments (6)

gmaclennan avatar gmaclennan commented on July 17, 2024

Hi @danielfdsilva,

If you're using osm-p2p-db (as opposed to osm-p2p - a simple wrapper) then you have control of the db instances you pass to the constructor, namely the hyperlog, the leveldb for join indexes, and the abstract-chunk-store (used for the kdb spatial index).

Each of these stores has a close() method usually, that takes a callback. You basically need to close each one yourself. It would result in problems trying to do this in osm-p2p-db because you control the data stores that are passed to osm-p2p-db and they could vary with their methods for closing.

This should be documented better somewhere, and I don't know if their is a better solution.

from osm-p2p-db.

hackergrrl avatar hackergrrl commented on July 17, 2024

This makes me realize that osm-p2p really ought to have a close() method.

from osm-p2p-db.

danielfdsilva avatar danielfdsilva commented on July 17, 2024

@gmaclennan
I'm actually using osm-p2p, since it prepares all the databases needed to work with osm-p2p-server.

I tried to access the different databases from the instance returned by osm-p2p, but I still get the LOCK error. I'm pretty sure I'm missing some.

I've tried:

db.db.close()
db.log.db.close()
db.kdb.db.close()

Any pointers at which I should be targeting?

from osm-p2p-db.

hackergrrl avatar hackergrrl commented on July 17, 2024

Run .close() on:

  • db.db
  • db.log.db
  • db.kdb.kdb.store

(Fun caveat: db.kdb.kdb doesn't exist at creation time; you need to wait a few ticks for it to silently set itself up async in the background.)


Looking at how much source code digging was necessary in order for me to figure that out, it seems a bit unreasonable that osm-p2p and osm-p2p-db don't expose close() methods.

from osm-p2p-db.

danielfdsilva avatar danielfdsilva commented on July 17, 2024

@noffle That seems to have done it! thanks :)

from osm-p2p-db.

hackergrrl avatar hackergrrl commented on July 17, 2024

Fixed in 4.2.0 🎉

from osm-p2p-db.

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.