Comments (6)
Another approach would be to respond to OS signals and restart based on those:
https://stackoverflow.com/questions/18106749/golang-catch-signals
For example, use HUP
signal to trigger a reload of tilesets, without taking the server all the way down and back up.
One of the issues with a filewatcher approach is that files may not be fully ready when they are first detected on the filesystem, either due to copy in progress, or tile generation in progress.
from mbtileserver.
Here is an unpolished idea how to implement this now that we have the handlers
package.
What if *mbtiles.ServiceSet
did not have a Handler()
method but would implement the http.Handler
interface itself and muxes each request in the ServeHTTP
method. Then we could dynamically check on the registered *mbtiles.DB
s and route accordingly. And, as aimed for, we could even add more DBs while the webserver is already listening. Of course we would need to protect ServiceSet.tilesets
with a mutex. Also the performance might be a tiny bit worse then using a dedicated and pre-filled *http.ServeMux
(just a guess, benchmarks would be needed to be sure).
I reckon there are not many consumers of handlers
in its current form, yet (maybe I am still the only one), so having a breaking API change is probably not a problem.
from mbtileserver.
@fawick what event would trigger adding more once the server is running? A file watcher detecting a change, an API call, or something else?
from mbtileserver.
In general, I think the answer depends on the needs of the users of the package handlers
because from the outside a call to ServiceSet.AddDBOnPath
would load the new tileset at runtime. For convenience, we could refactor filepath.Walk
over a given directory into an own exported method so it does not need to be reimplemented on the outside. (That method could also remove any mbtiles.DBs
, that are gone in the meantime).
Specific to the mbtileserver main
, we could delegate the decision to the user, too, and have command line switches that trigger either the installation of an HTTP API endpoint, or the installation of a file watcher, or both. My point here is that all of this is outside of handlers
.
from mbtileserver.
The new concurrent map
in Go 1.9 should give us what we need for managing concurrency: https://golang.org/doc/go1.9#sync-map. No need for a separate library.
from mbtileserver.
Resolved by #69
from mbtileserver.
Related Issues (20)
- BUG: invalid tiles cause panic on sqlite connections
- BUG: Map preview fails when 'center' property is not present in metadata HOT 7
- caching options HOT 1
- Build Error with GCC11 HOT 5
- DOC: Add note that user needs to increase max open files limit if using several tilesets
- Deploy arm64 image to Docker Hub HOT 4
- Consider alternative basemap tile providers HOT 9
- Add multiple subdomain support HOT 1
- Missing tiles returned as 256x256 transparent tiles HOT 11
- Serve tiles from blob-storage HOT 1
- it is not support EPSG 4326 HOT 2
- Migrate from Docker Hub to Github Packages registery
- Include version in CLI
- mbtileserver vs Martin Comparison? HOT 2
- Consider adding a /metrics endpoint HOT 1
- Map preview does not work when using reverse proxy with HTTPS HOT 6
- Use of stadiamaps? HOT 9
- Docker 404 Error HOT 4
- Crash when issue with one tile HOT 4
- Enhancement: support TileJSON 3.0.0
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from mbtileserver.