Skip to content

refactor(fsnotifyext): remove unnecessary mutex usage from Deduper #2196

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

Merged
merged 6 commits into from
May 26, 2025

Conversation

wazazaby
Copy link
Contributor

Hello,

This is a small refactor of the Deduper component, here's a list of the introduced changes :

  • Move the Deduper timers map to goroutine, to avoid mutex usage as it's read from / written to from a single goroutine.
  • Deduper.GetChan now returns a receive only channel, as only the internal fsnotify.Watcher instance should be allowed to send events to it.
  • Use fsnotify.Event.Has to check against Chmod operations (as per recommended by the fsnotify.Event.Op godoc).
  • In Executor.watchTasks - remove check against Chmod operations, it's already handled in the Deduper.GetChan goroutine.
  • Add a little bit of godoc on the Deduper.GetChan method to explain that.
  • Run a go mod tidy.

Following the contributing guidelines, I will squash the commits upon merging (if it ever happens ^^).

Thank you :)

@wazazaby wazazaby force-pushed the chore/improve-deduper branch from 8e8f35f to 478dd5e Compare April 22, 2025 09:53
@andreynering andreynering self-requested a review April 22, 2025 13:41
@wazazaby wazazaby force-pushed the chore/improve-deduper branch from 478dd5e to b5d406c Compare May 22, 2025 19:08
Copy link
Member

@andreynering andreynering 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 @wazazaby!

I found https://github.com/helshabini/fsbroker recently, and may give it a try.

In the meantime, your changes make sense, so I'm just merging it 🙂

@andreynering andreynering merged commit be45eb0 into go-task:main May 26, 2025
15 checks passed
@wazazaby wazazaby deleted the chore/improve-deduper branch May 27, 2025 07:42
@wazazaby
Copy link
Contributor Author

@andreynering thank you :)

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.

2 participants