Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

cachalot

Package Overview
Dependencies
Maintainers
1
Versions
23
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

cachalot - npm Package Compare versions

Comparing version 1.5.1 to 1.6.0

7

CHANGELOG.md

@@ -0,1 +1,8 @@

# [1.6.0](https://github.com/TinkoffCreditSystems/cachalot/compare/v1.5.1...v1.6.0) (2020-02-14)
### Features
* Queue "cached" commands if its execution timed out ([b024999](https://github.com/TinkoffCreditSystems/cachalot/commit/b024999))
## [1.5.1](https://github.com/TinkoffCreditSystems/cachalot/compare/v1.5.0...v1.5.1) (2020-02-12)

@@ -2,0 +9,0 @@

1

dist/errors.d.ts

@@ -5,1 +5,2 @@ export declare function ParseError(error: Error): Error;

export declare function OperationTimeoutError(timeout: number): Error;
export declare function isOperationTimeoutError(error: any): boolean;

@@ -27,2 +27,6 @@ "use strict";

exports.OperationTimeoutError = OperationTimeoutError;
function isOperationTimeoutError(error) {
return error instanceof Error && error.name === constants_1.ERRORS.OperationTimeoutError;
}
exports.isOperationTimeoutError = isOperationTimeoutError;
//# sourceMappingURL=errors.js.map

6

dist/storages/base.d.ts

@@ -20,3 +20,3 @@ import { ConnectionStatus } from '../connection-status';

fn: CommandFn;
params: any;
params: any[];
}

@@ -125,5 +125,7 @@ /**

* All commands wrapped with this method will be "cached". This means that if there are problems with the connection
* the response will be sent immediately and the command will be executed later when the connection is restored.
* the response will be sent immediately and the command will be executed later when the connection is restored
* or current execution timed out.
*/
private cachedCommand;
private queueCommand;
/**

@@ -130,0 +132,0 @@ * Saves only new not touched tags in tag storage.

@@ -11,2 +11,3 @@ "use strict";

const deserialize_1 = __importDefault(require("../deserialize"));
const errors_1 = require("../errors");
const record_1 = __importDefault(require("../record"));

@@ -177,3 +178,4 @@ const create_tag_1 = __importDefault(require("../record/create-tag"));

* All commands wrapped with this method will be "cached". This means that if there are problems with the connection
* the response will be sent immediately and the command will be executed later when the connection is restored.
* the response will be sent immediately and the command will be executed later when the connection is restored
* or current execution timed out.
*/

@@ -186,11 +188,21 @@ async cachedCommand(fn, ...args) {

if (connectionStatus !== connection_status_1.ConnectionStatus.CONNECTED) {
this.commandsQueue.push({
fn,
params: args
});
this.queueCommand(fn, args);
}
else {
await fn(...args);
try {
await fn(...args);
}
catch (error) {
if (errors_1.isOperationTimeoutError(error)) {
this.queueCommand(fn, args);
}
else {
throw error;
}
}
}
}
queueCommand(fn, params) {
this.commandsQueue.push({ fn, params });
}
/**

@@ -197,0 +209,0 @@ * Saves only new not touched tags in tag storage.

{
"name": "cachalot",
"version": "1.5.1",
"version": "1.6.0",
"description": "Cache manager for nodejs with support different cache strategies",

@@ -5,0 +5,0 @@ "keywords": [

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc