backendless 7.0.3 → 7.0.5

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.
@@ -126,9 +126,17 @@ var Logging = /*#__PURE__*/function () {
126
126
  }, {
127
127
  key: "checkMessagesLen",
128
128
  value: function checkMessagesLen() {
129
- if (this.messages.length >= this.numOfMessages) {
130
- this.startFlushInterval();
129
+ var _this3 = this;
130
+ if (this.checkMessagesLenTimer) {
131
+ clearTimeout(this.checkMessagesLenTimer);
131
132
  }
133
+ this.checkMessagesLenTimer = setTimeout(function () {
134
+ if (_this3.messages.length >= _this3.numOfMessages) {
135
+ _this3.flush();
136
+ } else {
137
+ _this3.startFlushInterval();
138
+ }
139
+ }, 0);
132
140
  }
133
141
  }, {
134
142
  key: "checkMessagesLimit",
@@ -140,10 +148,10 @@ var Logging = /*#__PURE__*/function () {
140
148
  }, {
141
149
  key: "startFlushInterval",
142
150
  value: function startFlushInterval() {
143
- var _this3 = this;
151
+ var _this4 = this;
144
152
  if (!this.flushInterval) {
145
153
  this.flushInterval = setTimeout(function () {
146
- return _this3.flush();
154
+ return _this4.flush();
147
155
  }, this.timeFrequency * 1000);
148
156
  }
149
157
  }
@@ -126,9 +126,17 @@ var Logging = /*#__PURE__*/function () {
126
126
  }, {
127
127
  key: "checkMessagesLen",
128
128
  value: function checkMessagesLen() {
129
- if (this.messages.length >= this.numOfMessages) {
130
- this.startFlushInterval();
129
+ var _this3 = this;
130
+ if (this.checkMessagesLenTimer) {
131
+ clearTimeout(this.checkMessagesLenTimer);
131
132
  }
133
+ this.checkMessagesLenTimer = setTimeout(function () {
134
+ if (_this3.messages.length >= _this3.numOfMessages) {
135
+ _this3.flush();
136
+ } else {
137
+ _this3.startFlushInterval();
138
+ }
139
+ }, 0);
132
140
  }
133
141
  }, {
134
142
  key: "checkMessagesLimit",
@@ -140,10 +148,10 @@ var Logging = /*#__PURE__*/function () {
140
148
  }, {
141
149
  key: "startFlushInterval",
142
150
  value: function startFlushInterval() {
143
- var _this3 = this;
151
+ var _this4 = this;
144
152
  if (!this.flushInterval) {
145
153
  this.flushInterval = setTimeout(function () {
146
- return _this3.flush();
154
+ return _this4.flush();
147
155
  }, this.timeFrequency * 1000);
148
156
  }
149
157
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "backendless",
3
- "version": "7.0.3",
3
+ "version": "7.0.5",
4
4
  "description": "Backendless JavaScript SDK for Node.js and the browser",
5
5
  "browser": "dist/backendless.js",
6
6
  "main": "lib/index.js",
@@ -103,9 +103,17 @@ export default class Logging {
103
103
  }
104
104
 
105
105
  checkMessagesLen() {
106
- if (this.messages.length >= this.numOfMessages) {
107
- this.startFlushInterval()
106
+ if (this.checkMessagesLenTimer) {
107
+ clearTimeout(this.checkMessagesLenTimer)
108
108
  }
109
+
110
+ this.checkMessagesLenTimer = setTimeout(() => {
111
+ if (this.messages.length >= this.numOfMessages) {
112
+ this.flush()
113
+ } else {
114
+ this.startFlushInterval()
115
+ }
116
+ }, 0)
109
117
  }
110
118
 
111
119
  checkMessagesLimit() {