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

Allow options pass through for Listen.to call #58

Merged

Conversation

yoka
Copy link
Contributor

@yoka yoka commented Mar 12, 2024

Hi, first of all thanks for this gem! I really like the way it piggybacks the modern rails features.

Now that we don't get too romantic here, I did head into some troubles. Not per se because of the gem itself but as we all know the rabbit hole can sometimes go pretty deep when planet align just perfectly.

Issue

Problem is that when running on virtualized environment that is using some not-so-inotify-friendly partition systems, the default mechanisms for detecting changes might fail altogether, and silently. There are multiple hoops that might end up causing this, but in my case it's this specific Windows computer that I'm developing on from time to time.

Environment

My problematic environment is:

Windows -> WSL -> Docker (docker compose + volumes mounted from Windows disks) -> Alpine Linux running RoR

Listen the silence

Now, the awesome guard gem listen (respect to ppl behind that too!) tries to handle problematic situations gracefully but might need a bit more help to function proper.

In the docs of listen gem, they nicely suggest to use wdm gem if you're on windows, but as it is obvious from my actual environment above, wdm gem does not really help in this case as my running environment is linux, but the underlying filesystem is actually NTFS so wdm did not scratch the itch.

What

So, I did a little stab at the code to enable passing options that Listen.to takes to be able to force the polling mechanism (and meanwhile at it, just pass through other options as well if given).

Copy link
Owner

@kirillplatonov kirillplatonov left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you for the PR! It looks good. The only suggestion is to rename listen_to_options to listen_options. It will align better with existing configuration (eg listen_paths).

@yoka
Copy link
Contributor Author

yoka commented Mar 12, 2024

Thank you for the PR! It looks good. The only suggestion is to rename listen_to_options to listen_options. It will align better with existing configuration (eg listen_paths).

Ah, the nemesis of devs - naming things. I did struggle with picking something there, I agree with your point.

@kirillplatonov kirillplatonov merged commit b7628b9 into kirillplatonov:main Mar 12, 2024
1 check passed
@kirillplatonov
Copy link
Owner

Awesome, thank you! I will check few more issues/PR and publish a new release in upcoming weeks.

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

2 participants