updateSessionTimestamp: return false if no write to DB needed

pull/1172/head
Audric Ackermann 6 years ago
parent 205e7f59e7
commit 492cc96ad2
No known key found for this signature in database
GPG Key ID: 999F434D76324AD4

@ -220,17 +220,15 @@ export class SessionProtocol {
timestamp: number | undefined, timestamp: number | undefined,
map: StringToNumberMap map: StringToNumberMap
): Promise<boolean> { ): Promise<boolean> {
if (map[device] === timestamp) {
return false;
}
if (!timestamp) { if (!timestamp) {
if (device in map) {
// tslint:disable-next-line: no-dynamic-delete // tslint:disable-next-line: no-dynamic-delete
delete map[device]; delete map[device];
} else {
return true;
}
return false;
}
map[device] = timestamp; map[device] = timestamp;
}
return true; return true;
} }

Loading…
Cancel
Save