aboutsummaryrefslogtreecommitdiff
path: root/src/watcher.c
diff options
context:
space:
mode:
authorSergey Poznyakoff <gray@gnu.org.ua>2013-01-01 19:48:33 +0200
committerSergey Poznyakoff <gray@gnu.org.ua>2013-01-01 20:53:41 +0200
commit66775034166ac35bda383ef41213c95021b37b64 (patch)
tree5a64f2e45955acc5758977c6de0740ba34707d65 /src/watcher.c
parentfad678ec27c7f37da83ddf3ba3a96196a962c238 (diff)
downloadwydawca-66775034166ac35bda383ef41213c95021b37b64.tar.gz
wydawca-66775034166ac35bda383ef41213c95021b37b64.tar.bz2
Avoid processing same triplet twice.release-2.2
* src/wydawca.h (file_triplet) <jq_prev,jq_next,job>: New members. (spool_commit_triplets,schedule_job): Update signature. (count_processable_triplets): Remove. (link_processable_triplets): New proto. (remove_triplet): New proto. (triplet_jq_unlink): New proto. * src/job.c (job) <triplet_list>: New member. (triplet_jq_unlink,jq_clear): New functions. (procspool): Create and stop spool timers. (wydawca_scanner): Call spool_create_timers. (schedule_job): Additional argument specifies triplets to process. Initialize job->triplet_list; (job_queue_runner): Call jq_clear. * src/net.c (handle_connection): Update call to schedule_job. * src/process.c (spool_cwd_add_new_file): Update call to spool_commit_triplets. * src/triplet.c (remove_triplet): Now extern. Takes two args. All uses updated. (spool_commit_triplets): Additional argument specifies triplets to process. (count_processable_triplets): Remove. (link_processable_triplets): New function. * src/watcher.c: Use link_processable_triplets to obtain a doubly-linked list of triplets to process. Pass it to schedule_job.
Diffstat (limited to 'src/watcher.c')
-rw-r--r--src/watcher.c7
1 files changed, 4 insertions, 3 deletions
diff --git a/src/watcher.c b/src/watcher.c
index 0c587f1..c18beab 100644
--- a/src/watcher.c
+++ b/src/watcher.c
@@ -155,7 +155,8 @@ process_event(struct inotify_event *ep)
{
static struct dirwatcher *dwp;
dwp = dirwatcher_find_wd(ep->wd);
-
+ struct file_triplet *tp;
+
if (ep->mask & IN_IGNORED)
/* nothing */ ;
else if (ep->mask & IN_Q_OVERFLOW)
@@ -187,8 +188,8 @@ process_event(struct inotify_event *ep)
logmsg(LOG_DEBUG, "%s/%s written",
dwp->spool->source_dir, ep->name);
if (spool_add_new_file(dwp->spool, ep->name, 0, NULL) == 0
- && count_processable_triplets())
- schedule_job(&inotify_spool, getuid());
+ && (tp = link_processable_triplets()))
+ schedule_job(&inotify_spool, getuid(), tp);
} else
logmsg(LOG_NOTICE, "%s/%s: unexpected event %x",
dwp->spool->source_dir, ep->name, ep->mask);

Return to:

Send suggestions and report system problems to the System administrator.