Add back in functionality to select different redis DB's per client

This commit is contained in:
Andrew Kingston 2023-05-31 10:52:39 +01:00
parent d3fdb52bf5
commit d926650232
4 changed files with 6 additions and 6 deletions

View File

@ -14,10 +14,7 @@ async function init() {
appClient = await new Client(utils.Databases.APP_METADATA).init()
cacheClient = await new Client(utils.Databases.GENERIC_CACHE).init()
lockClient = await new Client(utils.Databases.LOCKS).init()
writethroughClient = await new Client(
utils.Databases.WRITE_THROUGH,
utils.SelectableDatabase.WRITE_THROUGH
).init()
writethroughClient = await new Client(utils.Databases.WRITE_THROUGH).init()
}
export async function shutdown() {

View File

@ -183,6 +183,9 @@ class RedisWrapper {
CLOSED = false
init(this._select)
await waitForConnection(this._select)
if (this._select) {
this.getClient().select(this._select)
}
return this
}

View File

@ -41,7 +41,7 @@ export enum Databases {
*/
export enum SelectableDatabase {
DEFAULT = 0,
WRITE_THROUGH = 1,
SOCKET_IO = 1,
UNUSED_1 = 2,
UNUSED_2 = 3,
UNUSED_3 = 4,

View File

@ -15,7 +15,7 @@ export async function init() {
devAppClient = new redis.Client(redis.utils.Databases.DEV_LOCKS)
debounceClient = new redis.Client(redis.utils.Databases.DEBOUNCE)
flagClient = new redis.Client(redis.utils.Databases.FLAGS)
socketClient = new redis.Client(redis.utils.Databases.SOCKET_IO)
socketClient = new redis.Client(redis.utils.Databases.SOCKET_IO, redis.utils.SelectableDatabase.SOCKET_IO)
await devAppClient.init()
await debounceClient.init()
await flagClient.init()