Skip to content

Commit

Permalink
Make sure all message write in same queue
Browse files Browse the repository at this point in the history
  • Loading branch information
kevinzhow committed Oct 29, 2015
1 parent 7d41222 commit c8170b0
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 1 deletion.
2 changes: 1 addition & 1 deletion Yep/Services/FayeService.swift
Original file line number Diff line number Diff line change
Expand Up @@ -245,7 +245,7 @@ class FayeService: NSObject, MZFayeClientDelegate {

private func saveMessageWithMessageInfo(messageInfo: JSONDictionary) {
//这里不用 realmQueue 是为了下面的通知同步,用了 realmQueue 可能导致数据更新慢于通知
dispatch_async(dispatch_get_main_queue()) {
dispatch_async(realmQueue) {

guard let realm = try? Realm() else {
return
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1879,6 +1879,8 @@ class ConversationViewController: BaseViewController {
println("Can NOT handleReceivedNewMessagesNotification")
return
}

realm.refresh() // 确保是最新数据

// 按照 conversation 过滤消息,匹配的才能考虑插入
if let conversation = conversation {
Expand Down

0 comments on commit c8170b0

Please sign in to comment.