@@ -25,12 +25,6 @@ export default class App {
2525 this . eventSource = null
2626 this . connectTime = null
2727 this . keepAliveTimer = null
28- // make sure we got activity at least every 20 seconds
29- this . keepAliveSeconds = 20
30- // always reconnect after 5 minutes
31- this . maxConnectionLifetimeSeconds = 300
32- // consider cluster data older than 1 minute outdated
33- this . maxDataAgeSeconds = 60
3428 this . clusters = new Map ( )
3529 this . clusterStatuses = new Map ( )
3630 this . viewContainerTargetPosition = new PIXI . Point ( )
@@ -548,10 +542,10 @@ export default class App {
548542 if ( this . keepAliveTimer != null ) {
549543 clearTimeout ( this . keepAliveTimer )
550544 }
551- this . keepAliveTimer = setTimeout ( this . connect . bind ( this ) , this . keepAliveSeconds * 1000 )
545+ this . keepAliveTimer = setTimeout ( this . connect . bind ( this ) , this . config . keepAliveSeconds * 1000 )
552546 if ( this . connectTime != null ) {
553547 const now = Date . now ( )
554- if ( now - this . connectTime > this . maxConnectionLifetimeSeconds * 1000 ) {
548+ if ( now - this . connectTime > this . config . maxConnectionLifetimeSeconds * 1000 ) {
555549 // maximum connection lifetime exceeded => reconnect
556550 this . connect ( )
557551 }
@@ -563,7 +557,7 @@ export default class App {
563557 const nowSeconds = Date . now ( ) / 1000
564558 for ( const [ clusterId , statusObj ] of this . clusterStatuses . entries ( ) ) {
565559 const lastQueryTime = statusObj . last_query_time || 0
566- if ( lastQueryTime < nowSeconds - this . maxDataAgeSeconds ) {
560+ if ( lastQueryTime < nowSeconds - this . config . maxDataAgeSeconds ) {
567561 this . clusters . delete ( clusterId )
568562 updateNeeded = true
569563 } else if ( lastQueryTime < nowSeconds - 20 ) {
@@ -620,7 +614,7 @@ export default class App {
620614 const cluster = JSON . parse ( event . data )
621615 const status = that . clusterStatuses . get ( cluster . id )
622616 const nowSeconds = Date . now ( ) / 1000
623- if ( status && status . last_query_time < nowSeconds - that . maxDataAgeSeconds ) {
617+ if ( status && status . last_query_time < nowSeconds - that . config . maxDataAgeSeconds ) {
624618 // outdated data => ignore
625619 } else {
626620 that . clusters . set ( cluster . id , cluster )
0 commit comments