changeset 881:a240c8988c65

Save profile update time stamp in user_s table
author HIROSE Yuuji <yuuji@gentei.org>
date Wed, 16 Dec 2020 08:55:04 +0900
parents fa5be649968f
children a46e85d50954
files s4-funcs.sh s4-world.sh
diffstat 2 files changed, 10 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/s4-funcs.sh	Mon Dec 14 20:01:07 2020 +0900
+++ b/s4-funcs.sh	Wed Dec 16 08:55:04 2020 +0900
@@ -4244,7 +4244,15 @@
 	RELEASE SAVEPOINT pa2table_insert;
 	EOF
   rc=$?
-  [ $rc -eq 0 -a x"$tbl" = x"user" ] && touch $userupdateflag
+  if [ $rc -eq 0 -a x"$tbl" = x"user" ]; then
+    # XXX:	Sorry to use undeclared column in user.def
+    #		This is useful to mitigate account sync load
+    query <<-EOF
+	REPLACE INTO user_s(name, key, type, val)
+	VALUES('$user', 'profupdate', 'string', datetime('now', 'localtime'));
+	EOF
+    touch $userupdateflag
+  fi
   ## err "Table:$tbl update done "
   return $rc
 )
--- a/s4-world.sh	Mon Dec 14 20:01:07 2020 +0900
+++ b/s4-world.sh	Wed Dec 16 08:55:04 2020 +0900
@@ -88,7 +88,7 @@
   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')"
+      SYNCCOND="WHERE name in (SELECT name FROM m.user_s WHERE key='profupdate' AND val > '$prevsync')"
       err "prevsync=$prevsync"
       limited=`query "SELECT DISTINCT name FROM m.user_s $SYNCCOND;"`
       if [ -n "$limited" ]; then

yatex.org