# HG changeset patch # User HIROSE Yuuji # Date 1589796472 -32400 # Node ID 1aa16edc28e510c37d8f762d2feecba8bec3596c # Parent 19d28bbdbee81e3184abca9bc6beb237f8e0ad6e Partial Committing Starts: For session-DB separation, prepare session db file. diff -r 19d28bbdbee8 -r 1aa16edc28e5 s4-funcs.sh --- a/s4-funcs.sh Mon May 18 17:41:51 2020 +0900 +++ b/s4-funcs.sh Mon May 18 19:07:52 2020 +0900 @@ -16,6 +16,8 @@ querylog=${QUERYLOG:-$tmpdir/query.log} searchlog=${SEARCHLOG:-$tmpdir/search.log} workdb=$dbdir/tmpdata.sq3 +sessdb=$dbdir/sess.sq3 +sesstb=tmp.sess listentlimit=${LISTENTLIMIT:-30} admin=${ADMIN:-hostmaster@example.org} noreply=${NOREPLY:-noreply@example.org} @@ -371,6 +373,16 @@ exec 5> $sqi # Turning $sqi access through fd5 for continuous open state chmod o-r $tmpdir/error.out $tmpdir/debug.out rm $sqi + # Attach supplemental DB + cat >&5 <<-EOF + .output /dev/null + ATTACH DATABASE "$sessdb" AS tmp; + SELECT * FROM $sesstb; + CREATE TABLE IF NOT EXISTS $sesstb(user, skey, expire, UNIQUE(user, skey)); + DELETE FROM $sesstb WHERE expire < datetime('now', 'localtime'); + DELETE FROM $sesstb WHERE expire is NULL or expire = ''; + .output stdout + EOF } cleanup2() { # Dirty workaround for produced zombie processes if [ -n "$HTTP_USER_AGENT" ]; then # When called from httpd