# HG changeset patch # User HIROSE Yuuji # Date 1592884054 -32400 # Node ID fa23017ba273bee93be192da2495f414e45f78ba # Parent a87030974b993ff11f322d60f2e0d9fe3a038570 Sync only latest entries in user_m diff -r a87030974b99 -r fa23017ba273 s4-world.sh --- a/s4-world.sh Tue Jun 23 11:14:44 2020 +0900 +++ b/s4-world.sh Tue Jun 23 12:47:34 2020 +0900 @@ -79,6 +79,24 @@ fi err "`gdate +%S.%3N` Starting account synchronization[$$]" + prevsync=`tail -1 $syncflag|colrm 20` # 2020-06-21 12:30:00 = 19cols + syncall=${db%.*}.syncall + err syncallfile=$syncall + if [ -e $syncall ]; then + rm -f "$syncall" + err "Force update user_m for all users" + else + case "$prevsync" in + [2-9][0-9][0-9][0-9]-[01][0-9]-[0-3][0-9]\ [012][0-9]:??:??) + SYNCCOND="WHERE name in (SELECT name FROM m.user_s WHERE key='wtime' AND val > '$prevsync')" + err synccond limited to \ + `query "SELECT DISTINCT name FROM m.user_s $SYNCCOND;"` + err "Touch $syncall (owner=`id -un`) to update all user_m." + ;; + *) + echo arere ;; + esac + fi ## num=$(sqlite3 -bail -cmd 'PRAGMA FOREIGN_KEYS=on' $db <