View Single Post
Old 06-06-2011, 07:59 AM   #1
meme
Sigil developer
meme ought to be getting tired of karma fortunes by now.meme ought to be getting tired of karma fortunes by now.meme ought to be getting tired of karma fortunes by now.meme ought to be getting tired of karma fortunes by now.meme ought to be getting tired of karma fortunes by now.meme ought to be getting tired of karma fortunes by now.meme ought to be getting tired of karma fortunes by now.meme ought to be getting tired of karma fortunes by now.meme ought to be getting tired of karma fortunes by now.meme ought to be getting tired of karma fortunes by now.meme ought to be getting tired of karma fortunes by now.
 
Posts: 1,275
Karma: 1101600
Join Date: Jan 2011
Location: UK
Device: Kindle PW, K4 NT, K3, Kobo Touch
Scheduling jobs and waiting for other activities

kiwidude has kindly updated his Book Sync plugin to call my Kindle Collections plugin in order to streamline users adding books to their Kindle.

But I'm having an issue in that my Kindle Collections plugin reads the data from the Kindle before the Book Sync plugin has synced/sent all the books to the device. As a result, books just synced don't get put into collections because they aren't on the Kindle at the time the plugin is called.

I'm looking for the best was to deal with this.

One option is to change where in Book Sync the Kindle Collections plugin is called. But since I believe Book Sync just calls Send Devices code at some point, its the Send Devices that I'm really dependent on.

Another option suggested by kiwidude is to use jobs. However, when I set up a test of this, I can get the job added to the queue - but the job runs immediately - before all other jobs are complete (I'm testing with a long running count pages).

Is there a way to schedule a job but have it put at the end of the queue to only run when all other jobs are finished? Or a way to check the job queue to see if anything is on the queue before starting my code? Or a way to have the Book Sync code call the Kindle Collections plugin only after all its related jobs are complete?

I already deal with device connected and books on device available to read thanks to the updates that were made in calibre, but it looks like there might be another dependency.
meme is offline   Reply With Quote