refactor: split native hotpath fallback and dispatch branches
This commit is contained in:
@@ -19,11 +19,25 @@ export class QueryNativeHotpathAdapter {
|
||||
mode: 'json' | 'raw',
|
||||
): Promise<unknown> {
|
||||
if (!this.shouldUseNativeQuery()) {
|
||||
return mode === 'raw'
|
||||
? this.execRawFallback(legacyCommand, legacyArgs)
|
||||
: this.execJsonFallback(legacyCommand, legacyArgs);
|
||||
return this.dispatchFallback(legacyCommand, legacyArgs, mode);
|
||||
}
|
||||
|
||||
return this.dispatchNative(legacyCommand, legacyArgs, registryCommand, registryArgs, mode);
|
||||
}
|
||||
|
||||
private dispatchFallback(legacyCommand: string, legacyArgs: string[], mode: 'json' | 'raw'): Promise<unknown> {
|
||||
return mode === 'raw'
|
||||
? this.execRawFallback(legacyCommand, legacyArgs)
|
||||
: this.execJsonFallback(legacyCommand, legacyArgs);
|
||||
}
|
||||
|
||||
private dispatchNative(
|
||||
legacyCommand: string,
|
||||
legacyArgs: string[],
|
||||
registryCommand: string,
|
||||
registryArgs: string[],
|
||||
mode: 'json' | 'raw',
|
||||
): Promise<unknown> {
|
||||
return mode === 'raw'
|
||||
? this.nativeDirect.dispatchRaw(legacyCommand, legacyArgs, registryCommand, registryArgs)
|
||||
: this.nativeDirect.dispatchJson(legacyCommand, legacyArgs, registryCommand, registryArgs);
|
||||
|
||||
Reference in New Issue
Block a user