-
Notifications
You must be signed in to change notification settings - Fork 47
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
Clean DB #126
Comments
@imidoriya This feature is provided in master branch, give a try and kind me let know the result Thanks |
I wasn't able to see any shrinkage with my test. I submitted several jobs where the db-wal increased in size up to 2.2MB and it just stayed there after all jobs were completed / acked and Opening up the data.db, I still see 10 jobs which appear to have an Ack flag with a status of 5. So it looks like the |
Actually, setting |
Database is currently at 167MB for the data.db and 50MB for the data.db-wal. The after clear_acked _data, the shrink_disk_usage didn't change the size. |
@imidoriya sorry for the late response... I will follow up by a new pr to change the behavior of |
with the new change on my local, I can see the db size change, here is the sample code In [1]: from persistqueue import SQLiteAckQueue
In [2]: q = SQLiteAckQueue(path='data')
In [3]: s = "Database is currently at 167MB for the data.db and 50MB for the data.db-wal. The after clear_acked _data, the shrink_disk_usage didn't change the
...: size. %d"
In [4]: for x in range(200000):
...: q.put(s % x)
...: if x % 5000 == 0:
...: print("done %d" % x)
...:
In [5]: for x in range(100000):
...: item = q.get()
...: q.ack(item)
...: if x % 5000 == 0:
...: print("ack %d" % x)
In [6]: ls -lh data
In [7]: q.clear_acked_data()
In [8]: q.shrink_disk_usage()
In [9]: del q
In [10]: ls -lh data/ |
Excellent - thank you :) |
So this is odd - I had shrink_disk_usage disabled for a while and I just turned it back on. I have the job running in a thread as documented here. After it runs the shrink_disk_usage, the jobs no longer run. It appears I can add new items to the queue, but maybe the loop gets closed as the jobs themselves no longer run. |
I wonder if having multiple threads is preventing the vacuum from working properly and it just sort of hangs it. Do you have any examples of maybe an asyncio loop where it would do multiple jobs async in a single thread - curious if that would work better than trying to use sqlite in a thread safe way. Ultimately, my goal is to have a few queued tasks being run at any one moment be it with multiple threads or some async method - whatever works best. |
Any update on this, I am also running into a persistently growing db and I need to run async? |
As I queue jobs and complete them, the database doesn't decrease in size that I can tell in my tests. I just appears to grow and grow, saving the history. Once a job is complete, I want it gone as my jobs are large in size and I don't want it to store any anything. How do I keep the DB clean so it only contains pending jobs, not historical ones?
The text was updated successfully, but these errors were encountered: