Skip to content

Commit

Permalink
Merge branch 'fix/8'
Browse files Browse the repository at this point in the history
  • Loading branch information
wtetsu committed Oct 20, 2022
2 parents ee18d89 + b5775fc commit 0cf6613
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions pkg/notify/notify.go
Original file line number Diff line number Diff line change
Expand Up @@ -195,14 +195,19 @@ func (n *Notify) shouldExecute(filePath string, op Op) bool {
}

modifiedTime := time.GetFileModifiedTime(filePath)
if op == W {
if (modifiedTime - lastExecutionTime) < n.pendingPeriod*1000000 {

if op == W || op == C {
elapsed := modifiedTime - lastExecutionTime
logger.Debug("lastExecutionTime(%s): %d, %d", op, lastExecutionTime, elapsed)
if elapsed < n.pendingPeriod*1000000 {
logger.Debug("skipped: %s: %s (too frequent)", filePath, op)
return false
}
}
if op == R {
if (time.Now() - modifiedTime) > n.regardRenameAsModPeriod*1000000 {
elapsed := time.Now() - modifiedTime
logger.Debug("lastExecutionTime(%s): %d, %d", op, lastExecutionTime, elapsed)
if elapsed > n.regardRenameAsModPeriod*1000000 {
logger.Debug("skipped: %s: %s (unnatural rename)", filePath, op)
return false
}
Expand Down

0 comments on commit 0cf6613

Please sign in to comment.