aboutsummaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorDrew DeVault <sir@cmpwn.com>2019-07-08 18:32:31 -0400
committerDrew DeVault <sir@cmpwn.com>2019-07-08 18:32:31 -0400
commit133085b436f56bdd48fb1aba1184811b3a278d3c (patch)
tree5f010744ca4bd9e0cf97c6cdad93bf5e7feb8020 /lib
parent6797f9347603aff0831bf56566fbf164cbdda179 (diff)
Fix re-opening of expired pipe tabs
Diffstat (limited to 'lib')
-rw-r--r--lib/msgstore.go14
1 files changed, 13 insertions, 1 deletions
diff --git a/lib/msgstore.go b/lib/msgstore.go
index 595908d..038c3ca 100644
--- a/lib/msgstore.go
+++ b/lib/msgstore.go
@@ -92,7 +92,18 @@ func (store *MessageStore) FetchFull(uids []uint32, cb func(io.Reader)) {
}
}
if len(toFetch) > 0 {
- store.worker.PostAction(&types.FetchFullMessages{Uids: toFetch}, nil)
+ store.worker.PostAction(&types.FetchFullMessages{
+ Uids: toFetch,
+ }, func(msg types.WorkerMessage) {
+ switch msg.(type) {
+ case *types.Error:
+ for _, uid := range toFetch {
+ if _, ok := store.bodyCallbacks[uid]; ok {
+ delete(store.bodyCallbacks, uid)
+ }
+ }
+ }
+ })
}
}
@@ -169,6 +180,7 @@ func (store *MessageStore) Update(msg types.WorkerMessage) {
for _, cb := range cbs {
cb(msg.Content.Reader)
}
+ delete(store.bodyCallbacks, msg.Content.Uid)
}
}
case *types.MessagesDeleted: