# Rev 0.3.1: a libev-based event framework, now with better filesystem monitoring

**URL:** <https://www.ruby-forum.com/t/rev-0-3-1-a-libev-based-event-framework-now-with-better-filesystem-monitoring/177335>\
**Category:** Ruby\
**Created:** [October 15, 2009, 6:15am UTC](https://www.ruby-forum.com/t/rev-0-3-1-a-libev-based-event-framework-now-with-better-filesystem-monitoring/177335 "2009-10-15T06:15:57Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![murfhy](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/d26b3c/32.png) [@murfhy](https://www.ruby-forum.com/u/murfhy)\
**Post date:** [October 15, 2009, 6:15am UTC](https://www.ruby-forum.com/t/rev-0-3-1-a-libev-based-event-framework-now-with-better-filesystem-monitoring/177335/1 "2009-10-15T06:15:57Z")

</div>

rev 0.3.1 is largely a maintenance/bugfix release, but it comes with a  
new  
feature: configurable filesystem polling intervals.

The previous version introduced Rev::StatWatcher, a simple observer that  
notifies you if stat() for a given path changes. Thanks to rev’s  
libev-based core, rev can do this while monitoring for events on any  
Ruby IO  
object, and all in a single thread. On Linux, filesystem monitoring  
uses  
inotify, a high-performance interface which receives event notifications  
directly from the kernel. On all other platforms, libev monitors the  
filesystem using stat() polling.

The previous version did not allow you to configure this polling  
interval,  
and used a “default” of approximately 5 seconds intended to maximize  
performace. This is unacceptable in some cases where you want  
filesystem  
monitoring closer to realtime.

0.3.1 lets you create new filesystem watchers with a prespecified  
polling  
interval:

Rev::StatWatcher.new("./path/to/interesting/file", 0.5)

This will check the status of the given path every 0.5 seconds rather  
than  
every 5 seconds. Values below 0.1 are not particularly meaningful. On  
Linux the polling interval is ignored and events are received as soon as  
inotify reports them.
