diff options
author | Chocobozzz <me@florianbigard.com> | 2023-04-21 14:55:10 +0200 |
---|---|---|
committer | Chocobozzz <chocobozzz@cpy.re> | 2023-05-09 08:57:34 +0200 |
commit | 0c9668f77901e7540e2c7045eb0f2974a4842a69 (patch) | |
tree | 226d3dd1565b0bb56588897af3b8530e6216e96b /server/helpers/debounce.ts | |
parent | 6bcb854cdea8688a32240bc5719c7d139806e00b (diff) | |
download | PeerTube-0c9668f77901e7540e2c7045eb0f2974a4842a69.tar.gz PeerTube-0c9668f77901e7540e2c7045eb0f2974a4842a69.tar.zst PeerTube-0c9668f77901e7540e2c7045eb0f2974a4842a69.zip |
Implement remote runner jobs in server
Move ffmpeg functions to @shared
Diffstat (limited to 'server/helpers/debounce.ts')
-rw-r--r-- | server/helpers/debounce.ts | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/server/helpers/debounce.ts b/server/helpers/debounce.ts new file mode 100644 index 000000000..77d99a894 --- /dev/null +++ b/server/helpers/debounce.ts | |||
@@ -0,0 +1,16 @@ | |||
1 | export function Debounce (config: { timeoutMS: number }) { | ||
2 | let timeoutRef: NodeJS.Timeout | ||
3 | |||
4 | return function (_target, _key, descriptor: PropertyDescriptor) { | ||
5 | const original = descriptor.value | ||
6 | |||
7 | descriptor.value = function (...args: any[]) { | ||
8 | clearTimeout(timeoutRef) | ||
9 | |||
10 | timeoutRef = setTimeout(() => { | ||
11 | original.apply(this, args) | ||
12 | |||
13 | }, config.timeoutMS) | ||
14 | } | ||
15 | } | ||
16 | } | ||