Commit 0eb42084 authored by Carlos Garnacho's avatar Carlos Garnacho

libtracker-miner: Cancel ops in current buffers if a delete affects the file

If a folder being deleted affects operations currently in the currently
issued tasks (eg. those we emitted ::process-file on) and writeback buffers,
those operations would still attempt to proceed, with different degrees
of success.
parent 9a8c53ae
......@@ -350,6 +350,8 @@ static void task_pool_cancel_foreach (gpointer d
static void task_pool_limit_reached_notify_cb (GObject *object,
GParamSpec *pspec,
gpointer user_data);
static void writeback_pool_cancel_foreach (gpointer data,
gpointer user_data);
static GQuark quark_file_iri = 0;
static GInitableIface* miner_fs_initable_parent_iface;
......@@ -3029,6 +3031,16 @@ file_notifier_file_deleted (TrackerFileNotifier *notifier,
{
TrackerMinerFS *fs = user_data;
if (tracker_file_notifier_get_file_type (notifier, file) == G_FILE_TYPE_DIRECTORY) {
/* Cancel all pending tasks on files inside the path given by file */
tracker_task_pool_foreach (fs->priv->task_pool,
task_pool_cancel_foreach,
file);
tracker_task_pool_foreach (fs->priv->writeback_pool,
writeback_pool_cancel_foreach,
file);
}
if (check_item_queues (fs, QUEUE_DELETED, file, NULL)) {
miner_fs_queue_file (fs, fs->priv->items_deleted, file, FALSE);
item_queue_handlers_set_up (fs);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment