]> git.immae.eu Git - github/Chocobozzz/PeerTube.git/blobdiff - server/lib/redis.ts
Add short description in config
[github/Chocobozzz/PeerTube.git] / server / lib / redis.ts
index b284cab8fde5ed45c6d47e4573c7322473a4a53f..1fd366401c31445d455e6027983c90e2c5542e01 100644 (file)
@@ -54,6 +54,16 @@ class Redis {
     return this.exists(this.buildViewKey(ip, videoUUID))
   }
 
+  listJobs (jobsPrefix: string, state: string, mode: 'alpha', order: 'ASC' | 'DESC', offset: number, count: number) {
+    return new Promise<string[]>((res, rej) => {
+      this.client.sort(jobsPrefix + ':jobs:' + state, 'by', mode, order, 'LIMIT', offset.toString(), count.toString(), (err, values) => {
+        if (err) return rej(err)
+
+        return res(values)
+      })
+    })
+  }
+
   private getValue (key: string) {
     return new Promise<string>((res, rej) => {
       this.client.get(this.prefix + key, (err, value) => {