Closed cbs228 closed 1 year ago
I think for 99% of cases we would be okay with skipping the delete on unregister (and only having the registry delete files on initialization/replace them when an unregistered key gets used again).
The only downside I see would be for an addon that registers a lot of transient icons that don't need to be left around using disk space. But like I said that's quite the edge case and a trade-off I'm fine with to keep the map usable after shutdown. As far as expanding the icon registry API, sadly it would need to wait for 2.x unless we do something ugly to avoid breaking the ABI of Squaremap#iconRegistry
.
PR #115 appears to do the trick. If cleanup is desired at some point in the future, we could implement one on startup or shutdown using an mtime-based time filter. I don't believe this is necessary for now.
Icons added via
IconRegistry.register()
mechanism are removed from the web directory when squaremap shuts down. While this is fine for the internal web server, it causes 404 errors when:settings.internal-webserver.enabled = false
; andThis is known to impact the squaremap-signs plugin as of jpenilla/squaremap-addons@dd136b94df86f2d, but other plugins are likely impacted as well. Map tiles retrieve just fine when the game server is shut down, but the sign icons do not.
Should
IconRegistry.unregister()
and friends be updated to avoid removing files? Does the registry need a "persistent" flag for icons that should remain?