Branch: Tag:

2009-08-05

2009-08-05 13:06:15 by Henrik Grubbström (Grubba) <grubba@grubba.org>

Improved polling heuristics for polling interval on systems with unreliable mtime and ctime.

Rev: lib/modules/Filesystem.pmod/Monitor.pmod/basic.pike:1.20

1:   //   // Basic filesystem monitor.   // - // $Id: basic.pike,v 1.19 2009/08/04 10:51:33 grubba Exp $ + // $Id: basic.pike,v 1.20 2009/08/05 13:06:15 grubba Exp $   //   // 2009-07-09 Henrik Grubbström   //
183:    path, flags, ctime(next_poll) - "\n", st);    }    -  //! Calculate a suitable time for the next poll of this monitor. +  //! Calculate and set a suitable time for the next poll of this monitor.    //!    //! @param st    //! New stat for the monitor.
209:    if (d < 0) d = max_dir_check_interval || global::max_dir_check_interval;    if (d < delta) delta = d;    } +  if (last_change <= time(1)) { +  // Time until stable. +  d = last_change + (stable_time || global::stable_time) - time(1); +  d >>= 1; +  if (d < 0) d = 1; +  if (d < delta) delta = d; +  }    next_poll = time(1) + (delta || 1);    monitor_queue->adjust(this);    }