exit 0
fi
-latest_changes=$(ls /var/lib/replicate/changes-*.osc.gz | sort --version-sort | tail -1)
-tstamp=$(osmium fileinfo --extended --get=data.timestamp.last ${latest_changes})
+tstamp=$(osmium fileinfo --extended --get=data.timestamp.last /var/lib/replicate/changes-latest.osc.gz)
tstampsec=$(date --date=${tstamp} +%s)
nowsec=$(date +%s)
# No need to rollback now
rm sequence-prev.txt
+ # Get buffer count
+ buffers=$(osmium fileinfo --extended --get=data.buffers.count ${file})
+
+ # If this diff has content mark it as the latest diff
+ if [ $buffers -gt 0 ]
+ then
+ ln -f ${file} changes-latest.osc.gz
+ fi
+
# Queue these changes for expiry processing
- ln ${file} expire-queue/$file
+ ln ${file} expire-queue/${file}
# Delete old downloads
find . -name 'changes-*.gz' -mmin +300 -exec rm -f {} \;