Skip to content

Commit

Permalink
refactor: Make fsnotify event more readable. (#11836)
Browse files Browse the repository at this point in the history
Signed-off-by: yanggang <gang.yang@daocloud.io>

Signed-off-by: yanggang <gang.yang@daocloud.io>
  • Loading branch information
杨刚 authored Jan 25, 2023
1 parent 6069ded commit 9962620
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions reposerver/gpgwatcher.go
Original file line number Diff line number Diff line change
Expand Up @@ -31,10 +31,10 @@ func StartGPGWatcher(sourcePath string) error {
if !ok {
return
}
if event.Op&fsnotify.Create == fsnotify.Create || event.Op&fsnotify.Remove == fsnotify.Remove {
if event.Has(fsnotify.Create) || event.Has(fsnotify.Remove) {
// In case our watched path is re-created (i.e. during e2e tests), we need to watch again
// For more robustness, we retry re-creating the watcher up to maxRecreateRetries
if event.Name == sourcePath && event.Op&fsnotify.Remove == fsnotify.Remove {
if event.Name == sourcePath && event.Has(fsnotify.Remove) {
log.Warnf("Re-creating watcher on %s", sourcePath)
attempt := 0
for {
Expand Down

0 comments on commit 9962620

Please sign in to comment.