Skip to content
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

WindowsApiEmitter made easier to subclass. #344

Merged
merged 1 commit into from
Oct 13, 2018

Conversation

petrblahos
Copy link
Contributor

queue_events now does not call read_events directly. The call
was put into a member function _read_events instead, to make
it easier to replace the read_events functionality while keeping
the rest of the class going.

I need to make the WindowsApiObserver reconnect on the network
failure. I achieve it by catching certain errors in get_directory_handle
and read_events, but with the way the code has been organized
I had to "copy/paste" whole read_directory_changes file. If I take the
read_events out of the queue_events, I can just override on_thread_start,
on_thread_stop and the new _read_events to achieve this.

queue_events now does not call read_events directly. The call
was put into a member function _read_events instead, to make
it easier to replace the read_events functionality while keeping
the rest of the class going.
@xiaogigagagigigo
Copy link

I would like to know, how you solved that issue: I'm getting WindowsError: [Error 64] in read_directory_changes, when network-drive is sometimes not reachable. Would you be so kind to explain, how you managed to reconnect watchdog surveillance, if device is connected again?

@petrblahos
Copy link
Contributor Author

https://gist.github.com/petrblahos/7a5171d0f42297db2676c968c8034110

This works against current watchdog (without my PR applied). That's why I had to copy the whole winobserver from watchdog and add a thing here or there. With the patch applied, all things would happen in read_events function.

@BoboTiG
Copy link
Collaborator

BoboTiG commented Sep 18, 2018

@danilobellini I am OK to merge this one, WDYT?

@BoboTiG BoboTiG merged commit cedf21a into gorakhargosh:master Oct 13, 2018
@BoboTiG
Copy link
Collaborator

BoboTiG commented Oct 13, 2018

Thank you @petrblahos :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants