{"action":"created","issue":{"url":"https://api.github.com/repos/techfort/LokiJS/issues/274","labels_url":"https://api.github.com/repos/techfort/LokiJS/issues/274/labels{/name}","comments_url":"https://api.github.com/repos/techfort/LokiJS/issues/274/comments","events_url":"https://api.github.com/repos/techfort/LokiJS/issues/274/events","html_url":"https://github.com/techfort/LokiJS/issues/274","id":117000692,"number":274,"title":"Using LokiJS in a REST server","user":{"login":"joehui","id":8858936,"avatar_url":"https://avatars.githubusercontent.com/u/8858936?v=3","gravatar_id":"","url":"https://api.github.com/users/joehui","html_url":"https://github.com/joehui","followers_url":"https://api.github.com/users/joehui/followers","following_url":"https://api.github.com/users/joehui/following{/other_user}","gists_url":"https://api.github.com/users/joehui/gists{/gist_id}","starred_url":"https://api.github.com/users/joehui/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/joehui/subscriptions","organizations_url":"https://api.github.com/users/joehui/orgs","repos_url":"https://api.github.com/users/joehui/repos","events_url":"https://api.github.com/users/joehui/events{/privacy}","received_events_url":"https://api.github.com/users/joehui/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"milestone":null,"comments":6,"created_at":"2015-11-15T16:08:17Z","updated_at":"2015-11-17T14:19:05Z","closed_at":"2015-11-17T14:19:05Z","body":"I am working on a project that uses Lokijs and node.js to implement a REST server.  The database will be persistent to the File System.  There will only be 1 in-memory database instance for handling all the potential requests.\r\n\r\nSince the REST server can handle multiple HTTP requests at the same time, I am wondering when I \"save\" the database to the file system, if another REST request tries to \"save\" at approximately the same time, is there any chance of collision happening that would cause one of the \"save()\" calls to crash or to write incomplete data to the file system?\r\n\r\nThe documentation didn't mention anything about how this kind of concurrency should be handled.  Do I have to implement some kind of semaphore mechanism on my own to avoid any potential problem?  I can see that this would probably be related to how to the adaptor is written.  For my question, I am using the default FS adaptor for use with Nodejs.\r\n\r\nJoseph"},"comment":{"url":"https://api.github.com/repos/techfort/LokiJS/issues/comments/157382509","html_url":"https://github.com/techfort/LokiJS/issues/274#issuecomment-157382509","issue_url":"https://api.github.com/repos/techfort/LokiJS/issues/274","id":157382509,"user":{"login":"techfort","id":4130173,"avatar_url":"https://avatars.githubusercontent.com/u/4130173?v=3","gravatar_id":"","url":"https://api.github.com/users/techfort","html_url":"https://github.com/techfort","followers_url":"https://api.github.com/users/techfort/followers","following_url":"https://api.github.com/users/techfort/following{/other_user}","gists_url":"https://api.github.com/users/techfort/gists{/gist_id}","starred_url":"https://api.github.com/users/techfort/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/techfort/subscriptions","organizations_url":"https://api.github.com/users/techfort/orgs","repos_url":"https://api.github.com/users/techfort/repos","events_url":"https://api.github.com/users/techfort/events{/privacy}","received_events_url":"https://api.github.com/users/techfort/received_events","type":"User","site_admin":false},"created_at":"2015-11-17T14:19:05Z","updated_at":"2015-11-17T14:19:05Z","body":"@joehui interesting point. let us know how you get on and if you resolved your problem. Meanwhile I'm closing this, feel free to re-open if you think work is needed on Loki's side to resolve this."}}