LocalStorage for the browser and Node.js#41
Merged
frankebersoll merged 20 commits intomasterfrom Feb 19, 2016
Merged
Conversation
Content type is not enforced, and we use one common storage for heterogeneous data (events and configuration data).
- Added NodeFileStorage - Added DevDependency: mock-fs (https://github.com/tschaub/mock-fs) - Modified InMemoryStorage specs to work for both kinds of storage implementations
Contributor
Author
There was a problem hiding this comment.
This overrides the Configuration.useLocalStorage stub for Node.
Conflicts: package.json
Put code from BrowserStorage and NodeFileStorage into common base class
src/storage/BrowserStorage.ts
Outdated
| } | ||
|
|
||
| readDate(key: string) { | ||
| return Date.now(); |
Member
There was a problem hiding this comment.
could we get the tick count from the key?
let key = `ex-q-${new Date().toJSON()}-${Utils.randomNumber()}`;…ss.JavaScript into feature/storage
Member
|
Looking good |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This is the (quite naive) implementation of local storage that uses
window.localStoragein the browser and the file system in Node; see Issue #24Configuration
client.config.useLocalStorage();I can see making the event directory configurable for node - currently, it uses the default
.exceptionlessin the application's root directory.Performance
This could be drastically improved by using caching and background processing. We could use a combination of in-memory cache and then write the events to the file system (or local storage, which also uses the file system) in batches, so the ui is blocked for only very short times. In Node, I use synchronous file access which probably could be changed to async.
The only thing being cached now is the list of event names together with their timestamps.
ToDo
.expressrelative to the application root path