hmm, weird db error
This commit is contained in:
parent
55275ba9be
commit
a27941bb7d
@ -149,7 +149,7 @@ io.on('connection', (socket) => {
|
||||
});
|
||||
|
||||
socket.on('color', ({ c, x, y, t }: Placement) => {
|
||||
if (!user || c > 0xffffff || c < 0) {
|
||||
if (!user || c > 0xffffff || c < 0 || c === null) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -19,13 +19,14 @@ export class History {
|
||||
}
|
||||
|
||||
async insert(record: CanvasRecord): Promise<void> {
|
||||
const color = record.color ? record.color : 0;
|
||||
await this.db.run(
|
||||
`INSERT INTO Placement (user, x, y, ts, color) VALUES (?,?,?,?,?)`,
|
||||
record.user,
|
||||
record.x,
|
||||
record.y,
|
||||
record.ts,
|
||||
record.color,
|
||||
color,
|
||||
);
|
||||
}
|
||||
|
||||
|
@ -14,6 +14,7 @@ export class Imager {
|
||||
private _size: number,
|
||||
private _store = join(__dirname, '..', '..', '..', 'canvas.png'),
|
||||
private _debounce = 5000,
|
||||
private _resaveInterval = 60000,
|
||||
) {}
|
||||
|
||||
async toImage(array: Uint32Array): Promise<Buffer> {
|
||||
@ -81,7 +82,7 @@ export class Imager {
|
||||
this._lastSave = Date.now();
|
||||
};
|
||||
|
||||
if (force || this._lastSave < Date.now() - this._debounce * 2) {
|
||||
if (force || this._lastSave < Date.now() - this._resaveInterval) {
|
||||
saveFn().catch((e) => console.error(e));
|
||||
return;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user