remove getSessionRequest

This commit is contained in:
Audric Ackermann 2020-06-17 08:50:28 +10:00
parent 10e095ba9d
commit 4d2b08f4a2
No known key found for this signature in database
GPG key ID: 999F434D76324AD4

View file

@ -270,34 +270,20 @@ export class SessionProtocol {
}
}
/**
* This is a utility function to avoid duplicate code between `getProcessedSessionRequest()` and `getSentSessionRequest()`
*/
private static async getSessionRequest(
device: string,
map: StringToNumberMap
): Promise<number | undefined> {
await SessionProtocol.fetchFromDBIfNeeded();
return map[device];
}
private static async getSentSessionRequest(
device: string
): Promise<number | undefined> {
return SessionProtocol.getSessionRequest(
device,
SessionProtocol.sentSessionsTimestamp
);
await SessionProtocol.fetchFromDBIfNeeded();
return SessionProtocol.sentSessionsTimestamp[device];
}
private static async getProcessedSessionRequest(
device: string
): Promise<number | undefined> {
return SessionProtocol.getSessionRequest(
device,
SessionProtocol.processedSessionsTimestamp
);
await SessionProtocol.fetchFromDBIfNeeded();
return SessionProtocol.processedSessionsTimestamp[device];
}
private static async hasAlreadySentSessionRequest(