Comments (5)
maybe is enough to run the cron script with flock
0,30 * * * * /usr/bin/flock -xn /tmp/diffengine.lock -c "/usr/local/bin/diffengine /home/ed/.diffengine"
from diffengine.
Just as a heads up for any other OS X users, you can find a portable version of flock
here. It doesn't support -x
so you'll need to call it with e.g. flock -n /tmp/diffengine.lock /usr/local/bin/diffengine /path/to/diffengine_config
.
from diffengine.
If you see something like this in your cron error log you know that jobs have overlapped:
Traceback (most recent call last):
File "/home/ed/.pyenv/versions/diffengine/lib/python3.6/site-packages/peewee.p
y", line 3683, in execute_sql
cursor.execute(sql, params or ())
sqlite3.OperationalError: database is locked
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "diffengine.py", line 460, in <module>
main()
File "diffengine.py", line 437, in main
version = entry.get_latest()
File "diffengine.py", line 171, in get_latest
self.save()
File "/home/ed/.pyenv/versions/diffengine/lib/python3.6/site-packages/peewee.p
y", line 4985, in save
rows = self.update(**field_dict).where(self._pk_expr()).execute()
File "/home/ed/.pyenv/versions/diffengine/lib/python3.6/site-packages/peewee.p
y", line 3316, in execute
return self.database.rows_affected(self._execute())
File "/home/ed/.pyenv/versions/diffengine/lib/python3.6/site-packages/peewee.p
y", line 2833, in _execute
return self.database.execute_sql(sql, params, self.require_commit)
File "/home/ed/.pyenv/versions/diffengine/lib/python3.6/site-packages/peewee.p
y", line 3690, in execute_sql
self.commit()
File "/home/ed/.pyenv/versions/diffengine/lib/python3.6/site-packages/peewee.p
y", line 3514, in __exit__
reraise(new_type, new_type(*exc_args), traceback)
File "/home/ed/.pyenv/versions/diffengine/lib/python3.6/site-packages/peewee.p
y", line 134, in reraise
raise value.with_traceback(tb)
File "/home/ed/.pyenv/versions/diffengine/lib/python3.6/site-packages/peewee.p
y", line 3683, in execute_sql
cursor.execute(sql, params or ())
peewee.OperationalError: database is locked
It would be nice to not rely on the db lock to guarantee that multiple processes don't interfere with each other. Perhaps eventually it should run as a daemon rather than from cron. One thing at a time though :-)
from diffengine.
That's a beautiful temporary fix that I need right now, thanks! I would still like to have something in the code though? Or perhaps it should just be a daemon... need to sit with it for a bit I guess.
from diffengine.
Thanks @ryanfb. Working cross-platform is another argument for doing this in Python.
from diffengine.
Related Issues (20)
- Photo changes HOT 1
- Can we use it for personal use only? HOT 3
- Info HOT 1
- pip 19 breaks install HOT 14
- Error message: WARNING - not tweeting without archive urls HOT 8
- SavePageNow 503 Service Unavailable HOT 1
- Link to Wayback Diff? HOT 3
- Unable to complete setup HOT 1
- 'EntryVersion' object has no attribute 'save_url' HOT 2
- Screenshot truncated
- Python code formatter integration HOT 4
- Change summary lang key default value to "the page" HOT 2
- Make `time.sleep` configurable and default to zero
- Remove Entry.blogged HOT 1
- Database migrations HOT 1
- Why tweet_status_id_str on EntryVersion and not Diff? HOT 1
- Avoid messages per entry from the handlers when they're not configured
- exceptions directory not copied during setup HOT 3
- update_with_media deprecated
- Interested in getting this project running. HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from diffengine.