From c5a165cfe3d7d73a4e9a7754cc35afefd53d8f5c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20L=C3=B8vbr=C3=B8tte=20Olsen?= <daniel@dodsorf.as> Date: Thu, 23 Apr 2020 21:17:19 +0200 Subject: [PATCH] make priority work Former-commit-id: 391257fb17ccb7c71c8ab5ba231af5f234e1602d --- src/main.rs | 2 +- test.sh | 7 ++++--- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/src/main.rs b/src/main.rs index dedb04c..6d70982 100644 --- a/src/main.rs +++ b/src/main.rs @@ -51,7 +51,7 @@ fn request_job(shared: State<SharedState>) -> Result<Json<Value>, NotFound<Strin .filter(|x| x.status == EStatus::Queued).cloned() .collect(); - list.sort_by(|a, b| b.description.length.cmp(&a.description.length)); + list.sort_by(|a, b| (b.description.priority, b.description.length).cmp(&(a.description.priority, a.description.length))); let job = list.get(0); diff --git a/test.sh b/test.sh index 583c94f..ae48210 100755 --- a/test.sh +++ b/test.sh @@ -13,14 +13,15 @@ curl "$base_url"/add_job -X POST -H "Content-Type: application/json" -d \ { "file_url": "https://pomf.dodsorf.as/f/vz9dtl.mkv", "file_name": "014", - "priority": 0, - "length": 20, + "priority": 15, + "length": 90, "resolution": [540, 960], "options": { "aomenc": "--lag-in-frames=25 --tile-columns=0 --tile-rows=0 --enable-fwd-kf=1 --bit-depth=10 --cpu-used=0 --end-usage=vbr --target-bitrate=60 --kf-min-dist=9999 --kf-max-dist=9999", "ffmpeg": "", "two_pass": true, - "pix_fmt": "YV12" + "pix_fmt": "YV12", + "fps": [24000, 1001] } } '