mirror of
https://github.com/mjl-/mox.git
synced 2025-07-12 17:44:35 +03:00
update to latest bstore (with support for an index on a []string: Message.DKIMDomains), and cyclic data types (to be used for Message.Part soon); also adds a context.Context to database operations.
This commit is contained in:
@ -222,7 +222,7 @@ func accountHandle(w http.ResponseWriter, r *http.Request) {
|
||||
err := archiver.Close()
|
||||
log.Check(err, "exporting mail close")
|
||||
}()
|
||||
if err := store.ExportMessages(log, acc.DB, acc.Dir, archiver, maildir, ""); err != nil {
|
||||
if err := store.ExportMessages(r.Context(), log, acc.DB, acc.Dir, archiver, maildir, ""); err != nil {
|
||||
log.Errorx("exporting mail", err)
|
||||
}
|
||||
|
||||
|
@ -1500,21 +1500,21 @@ func (Admin) ClientConfigDomain(ctx context.Context, domain string) mox.ClientCo
|
||||
|
||||
// QueueList returns the messages currently in the outgoing queue.
|
||||
func (Admin) QueueList(ctx context.Context) []queue.Msg {
|
||||
l, err := queue.List()
|
||||
l, err := queue.List(ctx)
|
||||
xcheckf(ctx, err, "listing messages in queue")
|
||||
return l
|
||||
}
|
||||
|
||||
// QueueSize returns the number of messages currently in the outgoing queue.
|
||||
func (Admin) QueueSize(ctx context.Context) int {
|
||||
n, err := queue.Count()
|
||||
n, err := queue.Count(ctx)
|
||||
xcheckf(ctx, err, "listing messages in queue")
|
||||
return n
|
||||
}
|
||||
|
||||
// QueueKick initiates delivery of a message from the queue.
|
||||
func (Admin) QueueKick(ctx context.Context, id int64) {
|
||||
n, err := queue.Kick(id, "", "")
|
||||
n, err := queue.Kick(ctx, id, "", "")
|
||||
if err == nil && n == 0 {
|
||||
err = errors.New("message not found")
|
||||
}
|
||||
@ -1523,7 +1523,7 @@ func (Admin) QueueKick(ctx context.Context, id int64) {
|
||||
|
||||
// QueueDrop removes a message from the queue.
|
||||
func (Admin) QueueDrop(ctx context.Context, id int64) {
|
||||
n, err := queue.Drop(id, "", "")
|
||||
n, err := queue.Drop(ctx, id, "", "")
|
||||
if err == nil && n == 0 {
|
||||
err = errors.New("message not found")
|
||||
}
|
||||
|
@ -249,7 +249,7 @@ func importStart(log *mlog.Log, accName string, f *os.File, skipMailboxPrefix st
|
||||
}
|
||||
acc.Lock() // Not using WithWLock because importMessage is responsible for unlocking.
|
||||
|
||||
tx, err := acc.DB.Begin(true)
|
||||
tx, err := acc.DB.Begin(context.Background(), true)
|
||||
if err != nil {
|
||||
acc.Unlock()
|
||||
xerr := acc.Close()
|
||||
@ -346,7 +346,7 @@ func importMessages(ctx context.Context, log *mlog.Log, token string, acc *store
|
||||
|
||||
conf, _ := acc.Conf()
|
||||
|
||||
jf, _, err := acc.OpenJunkFilter(log)
|
||||
jf, _, err := acc.OpenJunkFilter(ctx, log)
|
||||
if err != nil && !errors.Is(err, store.ErrNoJunkFilter) {
|
||||
ximportcheckf(err, "open junk filter")
|
||||
}
|
||||
@ -376,7 +376,7 @@ func importMessages(ctx context.Context, log *mlog.Log, token string, acc *store
|
||||
problemf("parsing message %s for updating junk filter: %v (continuing)", pos, err)
|
||||
return
|
||||
}
|
||||
err = jf.Train(!m.Junk, words)
|
||||
err = jf.Train(ctx, !m.Junk, words)
|
||||
if err != nil {
|
||||
problemf("training junk filter for message %s: %v (continuing)", pos, err)
|
||||
return
|
||||
|
Reference in New Issue
Block a user