diff --git a/tunnel-server/src/tunnel-store/index.ts b/tunnel-server/src/tunnel-store/index.ts index e951a10a..9a4b11ac 100644 --- a/tunnel-server/src/tunnel-store/index.ts +++ b/tunnel-server/src/tunnel-store/index.ts @@ -39,12 +39,12 @@ export type ActiveTunnelStore = { delete: (key: string, tx?: TransactionDescriptor) => Promise } -const txIdGenerator = () => { - let nextTxId = 0 +const idGenerator = () => { + let nextId = 0 return { next: () => { - const result = nextTxId - nextTxId += 1 + const result = nextId + nextId += 1 return result }, } @@ -53,7 +53,7 @@ const txIdGenerator = () => { export const inMemoryActiveTunnelStore = ({ log }: { log: Logger }): ActiveTunnelStore => { const keyToTunnel = new Map() const pkThumbprintToTunnel = arrayMap() - const txIdGen = txIdGenerator() + const txIdGen = idGenerator() return { get: async key => keyToTunnel.get(key), getByPkThumbprint: async pkThumbprint => pkThumbprintToTunnel.get(pkThumbprint), @@ -62,7 +62,7 @@ export const inMemoryActiveTunnelStore = ({ log }: { log: Logger }): ActiveTunne throw new KeyAlreadyExistsError(key) } const txId = txIdGen.next() - log.debug('setting tunnel %s: %j', key, txId, value) + log.debug('setting tunnel key %s id %s: %j', key, txId, value) keyToTunnel.set(key, Object.assign(value, { txId })) pkThumbprintToTunnel.add(value.publicKeyThumbprint, value) return { txId }