-
I want to delay every query by a given number of time so when developing locally I have a realistic testing scenario. I thought this would do it but it doesnt see to work. import type { Plugin } from "@envelop/core";
import { wait } from "@battletabs/essentials";
export const useDelayPlugin = (timeMs: number): Plugin => ({
onExecute({ executeFn, setExecuteFn }) {
setExecuteFn(async (args) => {
await wait(timeMs);
return executeFn(args);
});
},
}); Any ideas? |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 2 replies
-
Nevermind, the above does work, I was just making a mistake elsewhere in the code :P |
Beta Was this translation helpful? Give feedback.
-
Btw, it might conflict with some other plugins, if you are replacing the execute function. You might want to add a plugin that delays the context building, and that will add time to the total execution (unless what you really want is to delay the |
Beta Was this translation helpful? Give feedback.
Nevermind, the above does work, I was just making a mistake elsewhere in the code :P