Branch: Tag:

2013-07-12

2013-07-12 15:55:43 by 0

Change semantics of bump() to accept a time relative to now instead of a time
relative to next scheduled scan, and provide a better heuristics when no value
is provided. This new behavior is much more relevant in practical use, and the
method was only used internally as far as I know. Added refdoc.

410:       //! Bump the monitor to an earlier scan time.    //! +  //! @param flags +  //! @int +  //! @value 0 +  //! Don't recurse. +  //! @value 1 +  //! Check all monitors for the entire subtree. +  //! @endint +  //!    //! @param seconds -  //! Number of seconds to bump. Defaults to @expr{30@}. -  void bump(int|void flags, int|void seconds) +  //! Number of seconds from now to run next scan. Defaults to +  //! half of the remaining interval. +  void bump(MonitorFlags|void flags, int|void seconds)    { -  next_poll -= seconds || 30; +  int now = time(1); +  if (seconds) +  next_poll = now + seconds; +  else if (next_poll > now) +  next_poll -= (next_poll - now) / 2;    monitor_queue->adjust(this);       if ((flags & MF_RECURSE) && st->isdir && files) {