Skip to content

Commit

Permalink
refactor: Make fsnotify event more readable. (argoproj#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>
Signed-off-by: emirot <emirot.nolan@gmail.com>
  • Loading branch information
杨刚 authored and emirot committed Jan 27, 2023
1 parent 7814772 commit 95829b6
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 95829b6

Please sign in to comment.