Skip to content

Commit

Permalink
Remove not needed sendOutbox invocation on connectivity change
Browse files Browse the repository at this point in the history
Now that we are retrying on failed message send we are handling
all possible cases where we might end up with unsent messages:
* if message send fails immediately (we keep retrying)
* if the app was closed with unsent messages, we try (and retry)

The connectivity change was a good heuristic with the imperfect
retry strategy but is not needed any more.
  • Loading branch information
borisyankov committed Jan 14, 2019
1 parent 17e27ce commit 041a8bd
Showing 1 changed file with 2 additions and 8 deletions.
10 changes: 2 additions & 8 deletions src/boot/AppEventHandlers.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,15 +13,14 @@ import type {
Orientation as OrientationT,
UserIdMap,
} from '../types';
import { getSession, getUnreadByHuddlesMentionsAndPMs, getUsersById } from '../selectors';
import { getUnreadByHuddlesMentionsAndPMs, getUsersById } from '../selectors';
import { handleInitialNotification, NotificationListener } from '../notification';
import {
appOnline,
appOrientation,
appState,
initSafeAreaInsets,
reportPresence,
sendOutbox,
} from '../actions';

const componentStyles = StyleSheet.create({
Expand All @@ -33,7 +32,6 @@ const componentStyles = StyleSheet.create({
});

type Props = {|
needsInitialFetch: boolean,
dispatch: Dispatch,
children: ChildrenArray<*>,
unreadCount: number,
Expand All @@ -47,12 +45,9 @@ class AppEventHandlers extends PureComponent<Props> {
};

handleConnectivityChange = connectionInfo => {
const { dispatch, needsInitialFetch } = this.props;
const { dispatch } = this.props;
const isConnected = connectionInfo.type !== 'none' && connectionInfo.type !== 'unknown';
dispatch(appOnline(isConnected));
if (!needsInitialFetch && isConnected) {
dispatch(sendOutbox());
}
};

handleAppStateChange = state => {
Expand Down Expand Up @@ -100,7 +95,6 @@ class AppEventHandlers extends PureComponent<Props> {
}

export default connect((state: GlobalState) => ({
needsInitialFetch: getSession(state).needsInitialFetch,
usersById: getUsersById(state),
unreadCount: getUnreadByHuddlesMentionsAndPMs(state),
}))(AppEventHandlers);

0 comments on commit 041a8bd

Please sign in to comment.