Closed sergiorivas closed 3 years ago
Thanks, @sergiorivas! That's a nice touch with ignoring the most recently fetched photos.
It's not uncommon to maintain a database of thousands of images with Mingle, though. That's thousands of queries every time you fetch a new batch of images (usually every few minutes). Do you have any ideas as to how we could avoid that?
I think we can externalize the method verifying_integrity_for_deleted_photos
in order to be invoked from a background task like a cronjob. Then, you can delete removed photos in background and improve the performance. This idea could be applied to another context.
That seems a reasonable approach, @sergiorivas. As it is this feature isn't really feasible due to performance constraints, so I'll leave this pull request unmerged pending a change like you describe.
Just to be clear, I'm not expecting you to make that change — it's up for grabs, and this is a nice starting point.
I removed the optimization to be more general, but now the prune method can be called from a cronjob task.
Clean up instagram removed items consists in verifying deleted photos doing a http (head) request for stored photos, You have to check this after fetching photos. I try to do the process more efficient ignoring recently fetched photos.