summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTor Andersson <tor@ccxvii.net>2024-11-24 12:34:04 +0100
committerTor Andersson <tor@ccxvii.net>2024-11-24 13:06:18 +0100
commita9481cf40c87ef830833177bd1a368aa9b249e74 (patch)
tree305d9b484df77de15af7c09aa06655283ccac88c
parent3f2c801b616f4c23c28c03d938bbadefefb49eb0 (diff)
downloadserver-a9481cf40c87ef830833177bd1a368aa9b249e74.tar.gz
Add log entry for all timed out tournament games.
-rw-r--r--schema.sql6
-rw-r--r--server.js2
2 files changed, 8 insertions, 0 deletions
diff --git a/schema.sql b/schema.sql
index 4ae8bb5..d321295 100644
--- a/schema.sql
+++ b/schema.sql
@@ -590,6 +590,12 @@ create table if not exists tm_banned (
time datetime default current_timestamp
);
+create table if not exists tm_timeout (
+ user_id integer,
+ game_id integer,
+ time datetime default current_timestamp
+);
+
create table if not exists tm_queue (
user_id integer,
seed_id integer,
diff --git a/server.js b/server.js
index bd22beb..f813261 100644
--- a/server.js
+++ b/server.js
@@ -2643,6 +2643,7 @@ function time_control_ticker() {
do_resign(item.game_id, item.role, "timed out")
if (item.is_match) {
console.log("BANNED FROM TOURNAMENTS:", item.user_id)
+ TM_INSERT_TIMEOUT.run(item.user_id, item.game_id)
TM_INSERT_BANNED.run(item.user_id)
TM_DELETE_QUEUE_ALL.run(item.user_id)
}
@@ -2665,6 +2666,7 @@ const designs = require("./designs.js")
const TM_SELECT_BANNED = SQL("select exists ( select 1 from tm_banned where user_id=? )").pluck()
const TM_INSERT_BANNED = SQL("insert or ignore into tm_banned (user_id, time) values (?, datetime())")
+const TM_INSERT_TIMEOUT = SQL("insert into tm_timeout (user_id, game_id) values (?, ?)")
const TM_DELETE_QUEUE_ALL = SQL("delete from tm_queue where user_id=?")