- 
                Notifications
    
You must be signed in to change notification settings  - Fork 9
 
Change FileWatcher to stop printing watchfiles debug log #340
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Change FileWatcher to stop printing watchfiles debug log #340
Conversation
| 
           If we use or plan to use any Windows system, then this PR won't work.  | 
    
| # Two arguments below are ok for non-Windows systems. | ||
| # For more details, refer awatch documentation. | ||
| rust_timeout=sys.maxsize - 1, | ||
| yield_on_timeout=True, | 
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do you know what the impact of this would be on windows systems?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
But I think that if we change rust_timeout=sys.maxsize - 1, back to None.
Then it should work on Windows and won't print debug log. However I didn't test it.
This is because the timeout mechanism in awatch looks like this:
            if raw_changes == 'timeout':
                if yield_on_timeout:
                    yield set()
                else:
                    logger.debug('rust notify timeout, continuing')
So instead of printing debug log, it can yield set() and we can ignore it.
Only then debug logs won't print if it awatch was killed or not.
5444918    to
    5a84c3d      
    Compare
  
    
          
 We will also have to support Windows machines because there are existing users.  | 
    
5a84c3d    to
    8d6bb4e      
    Compare
  
    | 
           Isn't there any way to control DEBUG logging in watchfiles? For me that would be the best choice, this is just a DEBUG message!  | 
    
The underlying Rust code performs periodic checks to see if it should stop watching. These checks raise TimeoutError, which by default would log misleading debug messages. Setting yield_on_timeout=True makes it yield an empty set instead of printing debug logs. We handle these empty sets in the `ready()` method by continuing to wait.
8d6bb4e    to
    b0e52e8      
    Compare
  
    There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I really think we shouldn't go for this, we just need to disable the DEBUG logging if we have DEBUG logging enabled but find these particular messages too annoying and unhelpful.
| 
           We decided to abort this PR and handle it higher level.  | 
    
The underlying Rust code performs periodic checks to see
if it should stop watching. These checks raise TimeoutError,
which by default would log misleading debug messages.
The debug log was printed every 5 sec on linux.
Setting yield_on_timeout=True makes it yield an empty
set instead of printing debug logs.
We handle these empty sets in the
ready()method bycontinuing to wait.