-
-
Notifications
You must be signed in to change notification settings - Fork 51
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Modifications to SqliteStorage to allow for custom filepaths #77
Merged
+24
−12
Merged
Changes from 1 commit
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next
Next commit
modifications to SqliteStorage to allow for custom filepaths (outside…
… of aw-server)
commit d0714e2fb638ef960b985cc7820ae0f70c86150b
There are no files selected for viewing
This file contains 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
This file contains 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
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why lower it from 50 to 10?
And why do you need the enable_lazy_commit at all? It should work transparently?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sorry, the 50 to 10 was accidental. Fixed.
enable_lazy_commit=True
effectively makes the code asynchronous, which wasn't acceptable for a use-case I had (sync).There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I understood that the use-case was sync, but why do you really need it?
Why do you need the absolute latest event? If you actually do, can't you instead force a commit when you actually need it like when using the REST API?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Because I'm checking for the latest sent event sometimes, to know which events to send (I'd need to know about eventual uncommitted events).
I am calling it through the
ServerAPI
class inaw_server/api.py
, and there doesn't seem to be any commit done through the REST API? How would you force a commit through the REST API?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
https://github.com/ActivityWatch/aw-server/blob/master/aw_server/api.py#L53
https://github.com/ActivityWatch/aw-core/blob/master/aw_datastore/storages/sqlite.py#L224
If that's the case you should already be getting the latest event
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Well, that's weird, because I definitely didn't (That's why I did this in the first place). I'll take a closer look at it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe it's because you are running it as a seperate process?
Same thing here as with aw-server-rust, you should not be accessing a SQLite database from multiple threads or processes. This can corrupt the database if not configured properly.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not, I'm instantiating two
ServerAPI
objects with two differentSqliteDatastore
objects (with different db paths) in the same process and thread.I've reproduced the issue by setting
enable_lazy_commit=True
, not sure what is going wrong, only seems to happen if process dies shortly after commit?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I can't figure it out, I'm going ahead and merging this anyway.