change game list threshold from two weeks to 90 days
This commit is contained in:
parent
6a1a709f8b
commit
e21541d0af
4
index.js
4
index.js
|
|
@ -163,12 +163,12 @@ async function getGameListHandler(req, res) {
|
||||||
/* Save the async promise _before_ the query so we don't miss any updates while suspended. */
|
/* Save the async promise _before_ the query so we don't miss any updates while suspended. */
|
||||||
const gameUpdate = waitForAnyGameUpdate().then(() => 'update');
|
const gameUpdate = waitForAnyGameUpdate().then(() => 'update');
|
||||||
|
|
||||||
const cutoff = (+new Date()) - (2 * 7 * 24 * 3600 * 1000); /* 2 weeks ago */
|
const cutoff = (+new Date()) - (90 * 24 * 3600 * 1000); /* 90 days ago */
|
||||||
const whereClause = (afterTime === undefined) ? `true` : `modified > $afterTime`;
|
const whereClause = (afterTime === undefined) ? `true` : `modified > $afterTime`;
|
||||||
const querySql = `
|
const querySql = `
|
||||||
SELECT gameId, lightName, darkName, moves, status, timestamp, modified
|
SELECT gameId, lightName, darkName, moves, status, timestamp, modified
|
||||||
FROM games WHERE timestamp >= $cutoff AND ${whereClause} ORDER BY timestamp DESC
|
FROM games WHERE timestamp >= $cutoff AND ${whereClause} ORDER BY timestamp DESC
|
||||||
LIMIT 1000
|
LIMIT 200
|
||||||
`;
|
`;
|
||||||
const results = await (await dbInit).allAsync(querySql, {
|
const results = await (await dbInit).allAsync(querySql, {
|
||||||
$afterTime: afterTime,
|
$afterTime: afterTime,
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue