Skip to content

Commit

Permalink
Adding third argument to onset() call to signal a retry
Browse files Browse the repository at this point in the history
  • Loading branch information
avoidwork committed Feb 4, 2017
1 parent 10293a1 commit 5a2ca79
Show file tree
Hide file tree
Showing 6 changed files with 17 additions and 16 deletions.
10 changes: 5 additions & 5 deletions lib/haro.es6.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
* @author Jason Mulligan <jason.mulligan@avoidwork.com>
* @copyright 2017
* @license BSD-3-Clause
* @version 3.1.13
* @version 3.1.15
*/
"use strict";

Expand Down Expand Up @@ -833,7 +833,7 @@
return raw ? result : this.list(...result);
}

set (key, data, batch = false, override = false, lload = false) {
set (key, data, batch = false, override = false, lload = false, retry = false) {
const defer = deferred();

let x = clone(data),
Expand Down Expand Up @@ -870,7 +870,7 @@
defer.resolve(this.get(key));

return defer.promise.then(arg => {
this.onset(arg, batch);
this.onset(arg, batch, retry);

if (!batch && this.uri) {
this.transmit(key, x, og, override, method).catch(e => {
Expand All @@ -879,7 +879,7 @@
}

if (og) {
this.set(key, og, batch, true).then(() => {
this.set(key, og, batch, true, lload, true).then(() => {
if (this.logging) {
console.log("Reverted", key);
}
Expand Down Expand Up @@ -1155,7 +1155,7 @@
}

factory.transform = cast;
factory.version = "3.1.13";
factory.version = "3.1.15";

// Node, AMD & window supported
if (typeof exports !== "undefined") {
Expand Down
11 changes: 6 additions & 5 deletions lib/haro.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
* @author Jason Mulligan <jason.mulligan@avoidwork.com>
* @copyright 2017
* @license BSD-3-Clause
* @version 3.1.13
* @version 3.1.15
*/
"use strict";

Expand Down Expand Up @@ -1022,11 +1022,12 @@ function _classCallCheck(instance, Constructor) { if (!(instance instanceof Cons
key: "set",
value: function set(key, data) {
var batch = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
var override = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : false;

var _this13 = this;

var override = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : false;
var lload = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : false;
var retry = arguments.length > 5 && arguments[5] !== undefined ? arguments[5] : false;

var defer = deferred();

Expand Down Expand Up @@ -1065,7 +1066,7 @@ function _classCallCheck(instance, Constructor) { if (!(instance instanceof Cons
defer.resolve(this.get(key));

return defer.promise.then(function (arg) {
_this13.onset(arg, batch);
_this13.onset(arg, batch, retry);

if (!batch && _this13.uri) {
_this13.transmit(key, x, og, override, method).catch(function (e) {
Expand All @@ -1074,7 +1075,7 @@ function _classCallCheck(instance, Constructor) { if (!(instance instanceof Cons
}

if (og) {
_this13.set(key, og, batch, true).then(function () {
_this13.set(key, og, batch, true, lload, true).then(function () {
if (_this13.logging) {
console.log("Reverted", key);
}
Expand Down Expand Up @@ -1406,7 +1407,7 @@ function _classCallCheck(instance, Constructor) { if (!(instance instanceof Cons
}

factory.transform = cast;
factory.version = "3.1.13";
factory.version = "3.1.15";

// Node, AMD & window supported
if (typeof exports !== "undefined") {
Expand Down
2 changes: 1 addition & 1 deletion lib/haro.min.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion lib/haro.min.js.map

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "haro",
"version": "3.1.14",
"version": "3.1.15",
"description": "Harō is a modern immutable DataStore",
"main": "lib/haro.es6.js",
"scripts": {
Expand Down
6 changes: 3 additions & 3 deletions src/haro.js
Original file line number Diff line number Diff line change
Expand Up @@ -481,7 +481,7 @@
return raw ? result : this.list(...result);
}

set (key, data, batch = false, override = false, lload = false) {
set (key, data, batch = false, override = false, lload = false, retry = false) {
const defer = deferred();

let x = clone(data),
Expand Down Expand Up @@ -518,7 +518,7 @@
defer.resolve(this.get(key));

return defer.promise.then(arg => {
this.onset(arg, batch);
this.onset(arg, batch, retry);

if (!batch && this.uri) {
this.transmit(key, x, og, override, method).catch(e => {
Expand All @@ -527,7 +527,7 @@
}

if (og) {
this.set(key, og, batch, true).then(() => {
this.set(key, og, batch, true, lload, true).then(() => {
if (this.logging) {
console.log("Reverted", key);
}
Expand Down

0 comments on commit 5a2ca79

Please sign in to comment.