@clonegod/ttd-bsc-common 1.0.18 → 1.0.19
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.
|
@@ -85,21 +85,20 @@ class SimpleRedisClient {
|
|
|
85
85
|
yield new Promise(resolve => setTimeout(resolve, this.lockRetryDelayMs));
|
|
86
86
|
retries++;
|
|
87
87
|
}
|
|
88
|
-
if (
|
|
89
|
-
|
|
88
|
+
if (acquired) {
|
|
89
|
+
get_lock_time = Date.now();
|
|
90
|
+
return yield callback();
|
|
90
91
|
}
|
|
91
|
-
get_lock_time = Date.now();
|
|
92
|
-
return yield callback();
|
|
93
92
|
}
|
|
94
93
|
finally {
|
|
95
94
|
if (acquired) {
|
|
96
95
|
const release_delay = parseInt(process.env.NONCE_LOCK_RELEASE_DELAY_MS || String(release_lock_delay_ms));
|
|
97
96
|
yield (0, dist_1.sleep)(release_delay);
|
|
98
97
|
yield this.releaseLock(lock_key, lock_value);
|
|
99
|
-
(0, dist_1.log_info)(`withLock success: lock_key=${lock_key}, lock_value=${lock_value},
|
|
98
|
+
(0, dist_1.log_info)(`withLock success: lock_key=${lock_key}, lock_value=${lock_value}, retry times=${retries}, get lock take ${get_lock_time - first_try_time}ms, release_delay=${release_delay}ms, hold lock ${Date.now() - get_lock_time}ms`);
|
|
100
99
|
}
|
|
101
100
|
else {
|
|
102
|
-
(0, dist_1.log_warn)(`withLock failed: lock_key=${lock_key}, lock_value=${lock_value},
|
|
101
|
+
(0, dist_1.log_warn)(`withLock failed: lock_key=${lock_key}, lock_value=${lock_value}, retry times=${retries}, took ${Date.now() - first_try_time}ms`);
|
|
103
102
|
}
|
|
104
103
|
}
|
|
105
104
|
});
|