mirror of
https://github.com/mjl-/mox.git
synced 2025-07-13 14:54:35 +03:00
When removing an account, wait for the last account reference has gone away before removing the files.
The intent to remove the account is stored in the database. At startup, if there are any such referenes, they are applied by removing the account directories and the entry in the database. This ensures the account directory is properly removed, even on incomplete shutdown. Don't add an account when its directory already exits.
This commit is contained in:
@ -8,6 +8,8 @@ import (
|
||||
"testing"
|
||||
"time"
|
||||
|
||||
"github.com/mjl-/bstore"
|
||||
|
||||
"github.com/mjl-/mox/mox-"
|
||||
)
|
||||
|
||||
@ -87,7 +89,9 @@ func TestLoginAttempt(t *testing.T) {
|
||||
tcompare(t, len(l), 2)
|
||||
|
||||
// Removing account will keep last entry for mjl2.
|
||||
err = LoginAttemptRemoveAccount(ctxbg, "mjl1")
|
||||
err = AuthDB.Write(ctxbg, func(tx *bstore.Tx) error {
|
||||
return loginAttemptRemoveAccount(tx, "mjl1")
|
||||
})
|
||||
tcheck(t, err, "remove login attempt account")
|
||||
l, err = LoginAttemptList(ctxbg, "", 0)
|
||||
tcheck(t, err, "list login attempts")
|
||||
|
Reference in New Issue
Block a user