redis-smq-common 1.0.4 → 1.0.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +11 -0
- package/LICENSE +1 -1
- package/README.md +1 -1
- package/dist/src/lock-manager/lock-manager.js +7 -2
- package/dist/src/redis-client/redis-client.js +4 -3
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,16 @@
|
|
|
1
1
|
# CHANGELOG
|
|
2
2
|
|
|
3
|
+
## 1.0.6 (2023-02-15)
|
|
4
|
+
|
|
5
|
+
* fix: use path.resolve() to fix 'no such file or directory' error (2d33599)
|
|
6
|
+
|
|
7
|
+
## 1.0.5 (2023-01-06)
|
|
8
|
+
|
|
9
|
+
* chore: update license (9b817d2)
|
|
10
|
+
* build: update NPM dependencies to latest releases (b03795b)
|
|
11
|
+
* docs(readme): replace lgtm badge with code quality badge (ea6545a)
|
|
12
|
+
* build: migrate from lgtm to github code scanning (de3dcd4)
|
|
13
|
+
|
|
3
14
|
## 1.0.4 (2022-08-24)
|
|
4
15
|
|
|
5
16
|
* test(redis-client): cover srem command (caf3837)
|
package/LICENSE
CHANGED
package/README.md
CHANGED
|
@@ -7,9 +7,9 @@
|
|
|
7
7
|
|
|
8
8
|
<p>
|
|
9
9
|
<a href="https://github.com/weyoss/redis-smq-common/actions/workflows/tests.yml"><img src="https://github.com/weyoss/redis-smq-common/actions/workflows/tests.yml/badge.svg" alt="Tests" style="max-width:100%;" /></a>
|
|
10
|
+
<a href="https://github.com/weyoss/redis-smq-common/actions/workflows/codeql.yml" rel="nofollow"><img src="https://github.com/weyoss/redis-smq-common/actions/workflows/codeql.yml/badge.svg" alt="Code quality" /></a>
|
|
10
11
|
<a href="https://npmjs.org/package/redis-smq-common" rel="nofollow"><img src="https://img.shields.io/npm/v/redis-smq-common.svg" alt="NPM version" /></a>
|
|
11
12
|
<a href="https://codecov.io/github/weyoss/redis-smq-common?branch=master" rel="nofollow"><img src="https://img.shields.io/codecov/c/github/weyoss/redis-smq-common" alt="Coverage Status" /></a>
|
|
12
|
-
<a href="https://lgtm.com/projects/g/weyoss/redis-smq-common/context:javascript" rel="nofollow"><img src="https://img.shields.io/lgtm/grade/javascript/github/weyoss/redis-smq-common.svg?logo=lgtm&logoWidth=18" alt="Code quality" /></a>
|
|
13
13
|
</p>
|
|
14
14
|
|
|
15
15
|
[RedisSMQ](https://github.com/weyoss/redis-smq) shared components that may be used by integrated applications and extensions.
|
|
@@ -10,6 +10,7 @@ const fs = require("fs");
|
|
|
10
10
|
const lock_manager_method_not_allowed_error_1 = require("./errors/lock-manager-method-not-allowed.error");
|
|
11
11
|
const lock_manager_not_acquired_error_1 = require("./errors/lock-manager-not-acquired.error");
|
|
12
12
|
const lock_manager_not_released_error_1 = require("./errors/lock-manager-not-released.error");
|
|
13
|
+
const path_1 = require("path");
|
|
13
14
|
var ELockStatus;
|
|
14
15
|
(function (ELockStatus) {
|
|
15
16
|
ELockStatus[ELockStatus["unlocked"] = 0] = "unlocked";
|
|
@@ -24,8 +25,12 @@ var ELuaScript;
|
|
|
24
25
|
ELuaScript["RELEASE_LOCK"] = "RELEASE_LOCK";
|
|
25
26
|
ELuaScript["EXTEND_LOCK"] = "EXTEND_LOCK";
|
|
26
27
|
})(ELuaScript = exports.ELuaScript || (exports.ELuaScript = {}));
|
|
27
|
-
redis_client_1.RedisClient.addScript(ELuaScript.RELEASE_LOCK, fs
|
|
28
|
-
|
|
28
|
+
redis_client_1.RedisClient.addScript(ELuaScript.RELEASE_LOCK, fs
|
|
29
|
+
.readFileSync((0, path_1.resolve)(__dirname, './redis-client/lua/release-lock.lua'))
|
|
30
|
+
.toString());
|
|
31
|
+
redis_client_1.RedisClient.addScript(ELuaScript.EXTEND_LOCK, fs
|
|
32
|
+
.readFileSync((0, path_1.resolve)(__dirname, './redis-client/lua/extend-lock.lua'))
|
|
33
|
+
.toString());
|
|
29
34
|
class LockManager {
|
|
30
35
|
constructor(redisClient, lockKey, ttl, retryOnFail = false, autoExtend = false, throwExceptions = true) {
|
|
31
36
|
this.status = ELockStatus.unlocked;
|
|
@@ -6,6 +6,7 @@ const lua_scripts_1 = require("./lua-scripts");
|
|
|
6
6
|
const redis_client_error_1 = require("./errors/redis-client.error");
|
|
7
7
|
const empty_callback_reply_error_1 = require("../errors/empty-callback-reply.error");
|
|
8
8
|
const fs = require("fs");
|
|
9
|
+
const path_1 = require("path");
|
|
9
10
|
var ELuaScriptName;
|
|
10
11
|
(function (ELuaScriptName) {
|
|
11
12
|
ELuaScriptName["LPOPRPUSH"] = "LPOPRPUSH";
|
|
@@ -103,7 +104,7 @@ exports.RedisClient = RedisClient;
|
|
|
103
104
|
RedisClient.redisServerVersion = null;
|
|
104
105
|
RedisClient.scriptsLoaded = false;
|
|
105
106
|
RedisClient.luaScripts = new lua_scripts_1.LuaScripts();
|
|
106
|
-
RedisClient.addScript(ELuaScriptName.ZPOPHGETRPUSH, fs.readFileSync(
|
|
107
|
-
RedisClient.addScript(ELuaScriptName.LPOPRPUSH, fs.readFileSync(
|
|
108
|
-
RedisClient.addScript(ELuaScriptName.LPOPRPUSHEXTRA, fs.readFileSync(
|
|
107
|
+
RedisClient.addScript(ELuaScriptName.ZPOPHGETRPUSH, fs.readFileSync((0, path_1.resolve)(__dirname, './lua/zpophgetrpush.lua')).toString());
|
|
108
|
+
RedisClient.addScript(ELuaScriptName.LPOPRPUSH, fs.readFileSync((0, path_1.resolve)(__dirname, './lua/lpoprpush.lua')).toString());
|
|
109
|
+
RedisClient.addScript(ELuaScriptName.LPOPRPUSHEXTRA, fs.readFileSync((0, path_1.resolve)(__dirname, './lua/lpoprpushextra.lua')).toString());
|
|
109
110
|
//# sourceMappingURL=redis-client.js.map
|
package/package.json
CHANGED