Skip to content

Commit

Permalink
outbox: Remove not needed sendOutbox 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 again on
  next launch, inside `doInitialFetch` -- and keep retrying)

The connectivity change was a good heuristic with the imperfect
retry strategy but is not needed any more.
  • Loading branch information
borisyankov authored and gnprice committed Jan 14, 2019
1 parent f00dce5 commit 400f4ac
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 400f4ac

Please sign in to comment.