Comparing version 3.22.5 to 3.22.6
@@ -0,1 +1,8 @@ | ||
## [3.22.6](https://github.com/OptimalBits/bull/compare/v3.22.5...v3.22.6) (2021-05-17) | ||
### Bug Fixes | ||
* **job:** fix job log pagination, fixes [#2031](https://github.com/OptimalBits/bull/issues/2031) ([30aa0a9](https://github.com/OptimalBits/bull/commit/30aa0a99acb4a04a12f988840bc8ccc7a014fed3)) | ||
## [3.22.5](https://github.com/OptimalBits/bull/compare/v3.22.4...v3.22.5) (2021-05-11) | ||
@@ -2,0 +9,0 @@ |
@@ -169,3 +169,3 @@ 'use strict'; | ||
Queue.prototype.getJobLogs = function(jobId, start, end) { | ||
Queue.prototype.getJobLogs = function(jobId, start, end, asc = true) { | ||
start = _.isUndefined(start) ? 0 : start; | ||
@@ -177,8 +177,17 @@ end = _.isUndefined(end) ? -1 : end; | ||
const logsKey = this.toKey(jobId + ':logs'); | ||
multi.lrange(logsKey, -(end + 1), -(start + 1)); | ||
if (asc) { | ||
multi.lrange(logsKey, start, end); | ||
} else { | ||
multi.lrange(logsKey, -(end + 1), -(start + 1)); | ||
} | ||
multi.llen(logsKey); | ||
return multi.exec().then(result => ({ | ||
logs: result[0][1], | ||
count: result[1][1] | ||
})); | ||
return multi.exec().then(result => { | ||
if (!asc) { | ||
result[0][1].reverse(); | ||
} | ||
return { | ||
logs: result[0][1], | ||
count: result[1][1] | ||
} | ||
}); | ||
}; | ||
@@ -185,0 +194,0 @@ }; |
{ | ||
"name": "bull", | ||
"version": "3.22.5", | ||
"version": "3.22.6", | ||
"description": "Job manager", | ||
@@ -5,0 +5,0 @@ "engines": { |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
165726
3206