Skip to content

retryScreenshot for more Robust screenshot loop #95

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

Merged
merged 4 commits into from
May 8, 2024

Conversation

cparish312
Copy link
Contributor

@cparish312 cparish312 commented May 3, 2024

Now when the retrieval of the DisplayID or Display fails, the screenshot process is reattempted up to 3 times in a row.

This should help prevent silent exiting of the screenshot loop.

stopScreenCapture fail retries

Co-authored-by: Jason McGhee <mcghee.j@gmail.com>
@cparish312
Copy link
Contributor Author

Yup good addition!

@cparish312
Copy link
Contributor Author

Added in a db busyTimeout of 2 seconds. Main reason is being more robust to external applications locking the db

rem/DB.swift Outdated
@@ -59,6 +59,9 @@ class DatabaseManager {
db = try! Connection("db.sqlite3")
}

// 2 second busy timeout
db.busyTimeout = 2000
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

My initial reaction to this is- we're not doing writes from outside, just reads right? We should just support concurrent reads. Maybe something like:

try db.run("PRAGMA journal_mode = WAL")
// Maybe?
try db.run("PRAGMA synchronous = NORMAL")

Copy link
Owner

@jasonjmcghee jasonjmcghee left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice catch on recording function call

@jasonjmcghee jasonjmcghee merged commit 9e6730d into jasonjmcghee:main May 8, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants