         }
 
         MessageManager.getHistory(tempSubscription, lastMessageDate: date) { [weak self] nextPageDate in
+            self?.isRequestingHistory = false
+
             DispatchQueue.main.async {
                 self?.activityIndicator.stopAnimating()
 

                    self?.hideHeaderStatusView()
                }

                self?.isRequestingHistory = false
                self?.loadMoreMessagesFrom(date: date, loadRemoteHistory: false)

                if loadNextPage {
                    if let nextPageDate = nextPageDate {
                        self?.loadHistoryFromRemote(date: nextPageDate, loadNextPage: false)
                    }
                }

                // There are no new messages
                if nextPageDate == nil {
                    self?.dataController.loadedAllMessages = true
                    self?.syncCollectionView()
                } else {
                    self?.dataController.loadedAllMessages = false
                }

            collectionView?.insertItems(at: indexPaths)
            collectionView?.deleteItems(at: removedIndexPaths)
        }, completion: nil)
    }

    func loadHistoryFromRemote(date: Date?, loadNextPage: Bool = true) {
