challenge-sync-airbus: Use --delay-updates to avoid WRITE
This commit is contained in:
parent
c547c45d31
commit
59cf98ead2
@ -32,7 +32,7 @@ done &
|
|||||||
while ! [ -f SETTINGS/stop ] || [ /tmp/stop -nt SETTINGS/stop ]
|
while ! [ -f SETTINGS/stop ] || [ /tmp/stop -nt SETTINGS/stop ]
|
||||||
do
|
do
|
||||||
# Synchronize static files pages
|
# Synchronize static files pages
|
||||||
rsync -e "$SSH_OPTS" -av --delete PKI TEAMS SETTINGSDIST "${FRONTEND_HOSTNAME}":"${BASEDIR}"
|
rsync -e "$SSH_OPTS" -av --delete --delay-updates --partial-dir=.tmp/ PKI TEAMS SETTINGSDIST "${FRONTEND_HOSTNAME}":"${BASEDIR}"
|
||||||
|
|
||||||
# Synchronize submissions
|
# Synchronize submissions
|
||||||
rsync -e "$SSH_OPTS" -av --ignore-existing --delay-updates --temp-dir=.tmp/ --partial-dir=.tmp/ --remove-source-files "${FRONTEND_HOSTNAME}":"${BASEDIR}"/submissions/ submissions/
|
rsync -e "$SSH_OPTS" -av --ignore-existing --delay-updates --temp-dir=.tmp/ --partial-dir=.tmp/ --remove-source-files "${FRONTEND_HOSTNAME}":"${BASEDIR}"/submissions/ submissions/
|
||||||
|
@ -411,12 +411,19 @@ func main() {
|
|||||||
case ev := <-watcher.Events:
|
case ev := <-watcher.Events:
|
||||||
d, err := os.Lstat(ev.Name)
|
d, err := os.Lstat(ev.Name)
|
||||||
|
|
||||||
|
if err == nil && strings.HasPrefix(d.Name(), ".") {
|
||||||
|
if *debugINotify {
|
||||||
|
log.Println("Skipped event:", ev, "for", ev.Name)
|
||||||
|
}
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
|
||||||
if err == nil && watchedNotify == fsnotify.Create && ev.Op&fsnotify.Write == fsnotify.Write {
|
if err == nil && watchedNotify == fsnotify.Create && ev.Op&fsnotify.Write == fsnotify.Write {
|
||||||
log.Println("FSNOTIFY WRITE SEEN. Prefer looking at them, as it appears files are not atomically moved.")
|
log.Println("FSNOTIFY WRITE SEEN. Prefer looking at them, as it appears files are not atomically moved.")
|
||||||
watchedNotify = fsnotify.Write
|
watchedNotify = fsnotify.Write
|
||||||
}
|
}
|
||||||
|
|
||||||
if err == nil && ev.Op&fsnotify.Create == fsnotify.Create && d.Mode().IsDir() && d.Mode()&os.ModeSymlink == 0 && d.Name() != ".tmp" {
|
if err == nil && ev.Op&fsnotify.Create == fsnotify.Create && d.Mode().IsDir() && d.Mode()&os.ModeSymlink == 0 {
|
||||||
// Register new subdirectory
|
// Register new subdirectory
|
||||||
if err := watchsubdir(watcher, ev.Name); err != nil {
|
if err := watchsubdir(watcher, ev.Name); err != nil {
|
||||||
log.Println(err)
|
log.Println(err)
|
||||||
@ -476,7 +483,7 @@ func watchsubdir(watcher *fsnotify.Watcher, pathname string) error {
|
|||||||
} else {
|
} else {
|
||||||
for _, d := range ds {
|
for _, d := range ds {
|
||||||
p := path.Join(pathname, d.Name())
|
p := path.Join(pathname, d.Name())
|
||||||
if d.IsDir() && d.Name() != ".tmp" && d.Mode()&os.ModeSymlink == 0 {
|
if d.IsDir() && !strings.HasPrefix(d.Name(), ".") && d.Mode()&os.ModeSymlink == 0 {
|
||||||
if err := watchsubdir(watcher, p); err != nil {
|
if err := watchsubdir(watcher, p); err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user