aboutsummaryrefslogtreecommitdiffstats
path: root/worker
diff options
context:
space:
mode:
Diffstat (limited to 'worker')
-rw-r--r--worker/imap/cache.go1
-rw-r--r--worker/imap/connect.go2
-rw-r--r--worker/imap/observer.go2
-rw-r--r--worker/maildir/search.go1
-rw-r--r--worker/maildir/worker.go4
-rw-r--r--worker/notmuch/worker.go2
-rw-r--r--worker/types/worker.go1
7 files changed, 13 insertions, 0 deletions
diff --git a/worker/imap/cache.go b/worker/imap/cache.go
index b8673ae7..352ef313 100644
--- a/worker/imap/cache.go
+++ b/worker/imap/cache.go
@@ -145,6 +145,7 @@ func cacheDir() (string, error) {
// cleanCache removes stale entries from the selected mailbox cachedb
func (w *IMAPWorker) cleanCache(path string) {
+ defer log.PanicHandler()
start := time.Now()
var scanned, removed int
iter := w.cache.NewIterator(nil, nil)
diff --git a/worker/imap/connect.go b/worker/imap/connect.go
index d6c946db..5be916e7 100644
--- a/worker/imap/connect.go
+++ b/worker/imap/connect.go
@@ -111,6 +111,7 @@ func newTCPConn(addr string, timeout time.Duration) (*net.TCPConn, error) {
done := make(chan tcpConn)
go func() {
+ defer log.PanicHandler()
addr, err := net.ResolveTCPAddr("tcp", addr)
if err != nil {
done <- tcpConn{nil, err}
@@ -129,6 +130,7 @@ func newTCPConn(addr string, timeout time.Duration) (*net.TCPConn, error) {
select {
case <-time.After(timeout):
go func() {
+ defer log.PanicHandler()
if tcpResult := <-done; tcpResult.conn != nil {
tcpResult.conn.Close()
}
diff --git a/worker/imap/observer.go b/worker/imap/observer.go
index 2cfe8bd9..9ad311dd 100644
--- a/worker/imap/observer.go
+++ b/worker/imap/observer.go
@@ -76,6 +76,7 @@ func (o *observer) Start() {
return
}
go func() {
+ defer log.PanicHandler()
select {
case <-o.client.LoggedOut():
o.log("<-logout")
@@ -129,6 +130,7 @@ func (o *observer) DelayedReconnect() error {
}
go func() {
+ defer log.PanicHandler()
<-time.After(wait)
o.emit(reterr.Error())
}()
diff --git a/worker/maildir/search.go b/worker/maildir/search.go
index e70282e2..c667d48f 100644
--- a/worker/maildir/search.go
+++ b/worker/maildir/search.go
@@ -120,6 +120,7 @@ func (w *Worker) search(criteria *searchCriteria) ([]uint32, error) {
limit <- struct{}{}
wg.Add(1)
go func(key uint32) {
+ defer log.PanicHandler()
defer wg.Done()
success, err := w.searchKey(key, criteria, requiredParts)
if err != nil {
diff --git a/worker/maildir/worker.go b/worker/maildir/worker.go
index 54069538..a8ed0b50 100644
--- a/worker/maildir/worker.go
+++ b/worker/maildir/worker.go
@@ -458,6 +458,7 @@ func (w *Worker) sort(uids []uint32, criteria []*types.SortCriterion) ([]uint32,
limit <- struct{}{}
wg.Add(1)
go func(uid uint32) {
+ defer log.PanicHandler()
defer wg.Done()
info, err := w.msgHeadersFromUid(uid)
if err != nil {
@@ -528,6 +529,7 @@ func (w *Worker) threads(uids []uint32, criteria []*types.SortCriterion) ([]*typ
limit <- struct{}{}
wg.Add(1)
go func(uid uint32) {
+ defer log.PanicHandler()
defer wg.Done()
info, err := w.msgHeadersFromUid(uid)
if err != nil {
@@ -835,6 +837,7 @@ func (w *Worker) msgHeadersFromUid(uid uint32) (*models.MessageInfo, error) {
}
func (w *Worker) handleCheckMail(msg *types.CheckMail) {
+ defer log.PanicHandler()
if msg.Command == "" {
w.err(msg, fmt.Errorf("checkmail: no command specified"))
return
@@ -844,6 +847,7 @@ func (w *Worker) handleCheckMail(msg *types.CheckMail) {
cmd := exec.CommandContext(ctx, "sh", "-c", msg.Command)
ch := make(chan error)
go func() {
+ defer log.PanicHandler()
err := cmd.Run()
ch <- err
}()
diff --git a/worker/notmuch/worker.go b/worker/notmuch/worker.go
index 6d8e46d2..3b4bd5dc 100644
--- a/worker/notmuch/worker.go
+++ b/worker/notmuch/worker.go
@@ -688,6 +688,7 @@ func (w *worker) sort(uids []uint32,
}
func (w *worker) handleCheckMail(msg *types.CheckMail) {
+ defer log.PanicHandler()
if msg.Command == "" {
w.err(msg, fmt.Errorf("checkmail: no command specified"))
return
@@ -697,6 +698,7 @@ func (w *worker) handleCheckMail(msg *types.CheckMail) {
cmd := exec.CommandContext(ctx, "sh", "-c", msg.Command)
ch := make(chan error)
go func() {
+ defer log.PanicHandler()
err := cmd.Run()
ch <- err
}()
diff --git a/worker/types/worker.go b/worker/types/worker.go
index bd3553bc..a9056c0a 100644
--- a/worker/types/worker.go
+++ b/worker/types/worker.go
@@ -64,6 +64,7 @@ func (worker *Worker) queue(msg WorkerMessage) {
// Start processing the action queue and write all messages to the Actions
// channel, one by one. Stop when the action queue is empty.
func (worker *Worker) processQueue() {
+ defer log.PanicHandler()
for {
worker.Lock()
e := worker.actionQueue.Front()