Skip to content

Commit ed0029d

Browse files
author
xss
committed
disable logging for sub tracking
1 parent 909f2d4 commit ed0029d

File tree

1 file changed

+7
-6
lines changed

1 file changed

+7
-6
lines changed

js/tracker.js

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -716,15 +716,16 @@ function throttle_events(event) {
716716
function sub_to_nearby_sondes(){
717717
let bounds = map.getBounds().pad(1); // expand by one viewport
718718
let zoomed_out = map.getZoom() <= 6;
719+
const sub_logging = false;
719720
if (zoomed_out){
720721
// If we are fairly zooomed out - only give the slow feed
721722
var newClientTopic=[clientTopic[0]]
722723
for(let i = 1; i<clientTopic.length; i++){ // skip first slow topic
723724
if (client.isConnected() && !alwaysSub.includes(clientTopic[i].replace("sondes/",""))) {
724-
console.log("zoomed fully out. unsubbing from " + clientTopic[i])
725+
if (sub_logging) console.log("zoomed fully out. unsubbing from " + clientTopic[i])
725726
client.unsubscribe(clientTopic[i]);
726727
} else {
727-
console.log("retaining " + clientTopic[i]);
728+
if (sub_logging) console.log("retaining " + clientTopic[i]);
728729
newClientTopic.push(clientTopic[i])
729730
}
730731
}
@@ -735,10 +736,10 @@ function sub_to_nearby_sondes(){
735736
// If zoomed in then we sub to specific sondes
736737
for (let vehicle in vehicles){
737738
let topic = "sondes/"+vehicle;
738-
inside_bounds = map.getBounds().pad(1).contains(vehicles[vehicle].marker._latlng)
739+
inside_bounds = bounds.contains(vehicles[vehicle].marker._latlng)
739740
if (inside_bounds){
740741
if (!clientTopic.includes(topic)){
741-
console.log("Subbing to " + topic)
742+
if (sub_logging) console.log("Subbing to " + topic)
742743
if (client.isConnected()) {
743744
client.subscribe(topic);
744745
}
@@ -747,9 +748,9 @@ function sub_to_nearby_sondes(){
747748
} else {
748749
if (clientTopic.includes(topic)){
749750
if (alwaysSub.includes(vehicle)){
750-
console.log("retaining " + vehicle)
751+
if (sub_logging) console.log("retaining " + vehicle)
751752
} else {
752-
console.log("unsubbing from " + topic)
753+
if (sub_logging) console.log("unsubbing from " + topic)
753754
if (client.isConnected()) {
754755
client.unsubscribe(topic)
755756
}

0 commit comments

Comments
 (0)