@@ -41,6 +41,7 @@ import { getBackgroundTxMetadata } from 'shared/services/bolt/txMetadata'
4141export const NAME = 'jmx'
4242export const UPDATE = NAME + '/UPDATE'
4343export const UPDATE_JMX_VALUES = NAME + '/UPDATE_JMX_VALUES'
44+ export const UPDATE_JMX_VALUES_DONE = NAME + '/UPDATE_JMX_VALUES_DONE'
4445
4546/**
4647 * Selectors
@@ -140,20 +141,24 @@ export const jmxEpic = (some$, store) =>
140141 . filter ( s => s . state === CONNECTED_STATE )
141142 . merge ( some$ . ofType ( CONNECTION_SUCCESS ) )
142143 . mergeMap ( ( ) => {
143- return Rx . Observable . timer ( 0 , 20000 )
144- . merge ( some$ . ofType ( FORCE_FETCH ) )
145- . mergeMap ( ( ) =>
146- Rx . Observable . fromPromise ( fetchJmxValues ( store ) ) . catch ( ( ) =>
147- Rx . Observable . of ( [ ] )
144+ return (
145+ Rx . Observable . timer ( 0 , 20000 )
146+ . merge ( some$ . ofType ( FORCE_FETCH ) )
147+ // Throw away new calls until we're finished
148+ . throttle ( ( ) => some$ . ofType ( UPDATE_JMX_VALUES_DONE ) )
149+ . mergeMap ( ( ) =>
150+ Rx . Observable . fromPromise ( fetchJmxValues ( store ) ) . catch ( ( ) =>
151+ Rx . Observable . of ( [ ] )
152+ )
148153 )
149- )
150- . filter ( r => r )
151- . do ( res => store . dispatch ( updateJmxValues ( res ) ) )
152- . takeUntil (
153- some$
154- . ofType ( LOST_CONNECTION )
155- . filter ( connectionLossFilter )
156- . merge ( some$ . ofType ( DISCONNECTION_SUCCESS ) )
157- )
158- . mapTo ( { type : 'NOOP' } )
154+ . filter ( r => r )
155+ . do ( res => store . dispatch ( updateJmxValues ( res ) ) )
156+ . takeUntil (
157+ some$
158+ . ofType ( LOST_CONNECTION )
159+ . filter ( connectionLossFilter )
160+ . merge ( some$ . ofType ( DISCONNECTION_SUCCESS ) )
161+ )
162+ . mapTo ( { type : UPDATE_JMX_VALUES_DONE } )
163+ )
159164 } )
0 commit comments