1 /* Copyright 2012-present Facebook, Inc. 2 * Licensed under the Apache License, Version 2.0 */ 3 4 #include "watchman.h" 5 considerReap() const6bool watchman_root::considerReap() const { 7 time_t now; 8 9 if (idle_reap_age == 0) { 10 return false; 11 } 12 13 time(&now); 14 15 if (now > inner.last_cmd_timestamp + idle_reap_age && 16 (triggers.rlock()->empty()) && (now > inner.last_reap_timestamp) && 17 !unilateralResponses->hasSubscribers()) { 18 // We haven't had any activity in a while, and there are no registered 19 // triggers or subscriptions against this watch. 20 watchman::log( 21 watchman::ERR, 22 "root ", 23 root_path, 24 " has had no activity in ", 25 idle_reap_age, 26 " seconds and has no triggers or subscriptions, cancelling watch. " 27 "Set idle_reap_age_seconds in your .watchmanconfig to control this " 28 "behavior\n"); 29 return true; 30 } 31 32 inner.last_reap_timestamp = now; 33 34 return false; 35 } 36 37 38 /* vim:ts=2:sw=2:et: 39 */ 40