redis-smq-common 1.0.5 → 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
CHANGED
|
@@ -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