maybe fixes keychecker bricking on disabled org keys
This commit is contained in:
@@ -225,6 +225,7 @@ export class OpenAIKeyProvider implements KeyProvider<OpenAIKey> {
|
||||
const clone: OpenAIKey = {
|
||||
...keyFromPool,
|
||||
organizationId: orgId,
|
||||
isDisabled: false,
|
||||
hash: `oai-${crypto
|
||||
.createHash("sha256")
|
||||
.update(keyFromPool.key + orgId)
|
||||
@@ -245,7 +246,7 @@ export class OpenAIKeyProvider implements KeyProvider<OpenAIKey> {
|
||||
public disable(key: Key) {
|
||||
const keyFromPool = this.keys.find((k) => k.hash === key.hash);
|
||||
if (!keyFromPool || keyFromPool.isDisabled) return;
|
||||
keyFromPool.isDisabled = true;
|
||||
this.update(key.hash, { isDisabled: true });
|
||||
this.log.warn({ key: key.hash }, "Key disabled");
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user