aboutsummaryrefslogtreecommitdiff
path: root/modern
diff options
context:
space:
mode:
authorAnton Tananaev <anton@traccar.org>2022-05-28 14:21:13 -0700
committerAnton Tananaev <anton@traccar.org>2022-05-28 14:21:13 -0700
commita2fe2c3bddc17cbdad6acae6b86b352a4ea14522 (patch)
tree38ca0897b1f1ad0bd7a9d843edddad50caa8a65d /modern
parent941b4d5b8d365653f25937961c4b931ebebd4e6f (diff)
downloadtrackermap-web-a2fe2c3bddc17cbdad6acae6b86b352a4ea14522.tar.gz
trackermap-web-a2fe2c3bddc17cbdad6acae6b86b352a4ea14522.tar.bz2
trackermap-web-a2fe2c3bddc17cbdad6acae6b86b352a4ea14522.zip
FIx style issues
Diffstat (limited to 'modern')
-rw-r--r--modern/src/store/throttleMiddleware.js13
1 files changed, 5 insertions, 8 deletions
diff --git a/modern/src/store/throttleMiddleware.js b/modern/src/store/throttleMiddleware.js
index 9954b139..d5a98add 100644
--- a/modern/src/store/throttleMiddleware.js
+++ b/modern/src/store/throttleMiddleware.js
@@ -1,4 +1,4 @@
-import { batch } from "react-redux";
+import { batch } from 'react-redux';
const threshold = 3;
const interval = 1500;
@@ -7,9 +7,8 @@ export default () => (next) => {
const buffer = [];
let throttle = false;
let counter = 0;
-
+
setInterval(() => {
- console.log('batch');
if (throttle) {
if (buffer.length < threshold) {
throttle = false;
@@ -24,16 +23,14 @@ export default () => (next) => {
}, interval);
return (action) => {
- console.log(action);
if (action.type === 'devices/update' || action.type === 'positions/update') {
if (throttle) {
buffer.push(action);
- } else {
- counter += 1;
- return next(action);
+ return null;
}
- } else {
+ counter += 1;
return next(action);
}
+ return next(action);
};
};