diff options
author | Tor Andersson <tor@ccxvii.net> | 2023-09-12 18:45:41 +0200 |
---|---|---|
committer | Tor Andersson <tor@ccxvii.net> | 2023-09-13 00:39:18 +0200 |
commit | cfdaea82e9bf0ad50d1bd5163b3a3ceb1ec7e515 (patch) | |
tree | 6ada9e2db950f6161586d3c747528546f7d1da68 | |
parent | 925207ba97ddb648bd7ce87261f89b9dee51e620 (diff) | |
download | server-cfdaea82e9bf0ad50d1bd5163b3a3ceb1ec7e515.tar.gz |
Don't return unused replay_id from put_replay.
-rw-r--r-- | server.js | 6 |
1 files changed, 3 insertions, 3 deletions
@@ -1072,7 +1072,7 @@ const SQL_UPDATE_GAME_STATE = SQL("INSERT OR REPLACE INTO game_state (game_id,st const SQL_UPDATE_GAME_RESULT = SQL("UPDATE games SET status=?, result=?, xtime=datetime() WHERE game_id=?") const SQL_UPDATE_GAME_PRIVATE = SQL("UPDATE games SET is_private=1 WHERE game_id=?") -const SQL_INSERT_REPLAY = SQL("insert into game_replay (game_id,replay_id,role,action,arguments) values (?, (select coalesce(max(replay_id), 0) + 1 from game_replay where game_id=?) ,?,?,?) returning replay_id").pluck() +const SQL_INSERT_REPLAY = SQL("insert into game_replay (game_id,replay_id,role,action,arguments) values (?, (select coalesce(max(replay_id), 0) + 1 from game_replay where game_id=?) ,?,?,?)") const SQL_INSERT_SNAP = SQL("insert into game_snap (game_id,snap_id,state) values (?, (select coalesce(max(snap_id), 0) + 1 from game_snap where game_id=?), ?) returning snap_id").pluck() const SQL_SELECT_SNAP = SQL("select state from game_snap where game_id = ? and snap_id = ?").pluck() @@ -2006,7 +2006,7 @@ function snap_from_state(state) { function put_replay(game_id, role, action, args) { if (args !== undefined && args !== null && typeof args !== "number") args = JSON.stringify(args) - return SQL_INSERT_REPLAY.get(game_id, game_id, role, action, args) + SQL_INSERT_REPLAY.run(game_id, game_id, role, action, args) } function put_snap(game_id, state) { @@ -2032,7 +2032,7 @@ function put_game_state(game_id, state, old_active) { } function put_new_state(game_id, state, old_active, role, action, args) { - let replay_id = put_replay(game_id, role, action, args) + put_replay(game_id, role, action, args) if (state.active !== old_active) put_snap(game_id, state) put_game_state(game_id, state, old_active) |