fix: 按完成时刻分批清理并限制读连接池
This commit is contained in:
@@ -19,7 +19,7 @@ func TestOpenEmptyDirCreatesTables(t *testing.T) {
|
||||
}
|
||||
defer func() { _ = db.Close() }()
|
||||
|
||||
assertMigrationCount(t, db.Write, 2)
|
||||
assertMigrationCount(t, db.Write, 3)
|
||||
for _, table := range []string{
|
||||
"endpoints", "settings", "talk_grants", "groups", "group_members",
|
||||
"messages", "message_bodies", "deliveries", "receipts", "send_keys",
|
||||
@@ -41,7 +41,7 @@ func TestOpenIdempotentNoRemigrate(t *testing.T) {
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
assertMigrationCount(t, db1.Write, 2)
|
||||
assertMigrationCount(t, db1.Write, 3)
|
||||
_ = db1.Close()
|
||||
|
||||
db2, err := Open(dir, "FULL")
|
||||
@@ -49,7 +49,7 @@ func TestOpenIdempotentNoRemigrate(t *testing.T) {
|
||||
t.Fatal(err)
|
||||
}
|
||||
defer func() { _ = db2.Close() }()
|
||||
assertMigrationCount(t, db2.Write, 2)
|
||||
assertMigrationCount(t, db2.Write, 3)
|
||||
|
||||
if entries, readErr := os.ReadDir(filepath.Join(dir, "backup")); readErr == nil && len(entries) > 0 {
|
||||
t.Fatalf("idempotent reopen should not backup: %v", entries)
|
||||
@@ -83,7 +83,7 @@ CREATE TABLE schema_migrations (
|
||||
}
|
||||
defer func() { _ = db.Close() }()
|
||||
|
||||
assertMigrationCount(t, db.Write, 2)
|
||||
assertMigrationCount(t, db.Write, 3)
|
||||
assertTableExists(t, db.Write, "endpoints")
|
||||
assertTableExists(t, db.Write, "api_tokens")
|
||||
|
||||
@@ -96,7 +96,7 @@ CREATE TABLE schema_migrations (
|
||||
var names []string
|
||||
for _, e := range entries {
|
||||
names = append(names, e.Name())
|
||||
if e.Name() == "pre-migrate-v1-to-v2.db" {
|
||||
if e.Name() == "pre-migrate-v1-to-v4.db" {
|
||||
found = true
|
||||
info, statErr := e.Info()
|
||||
if statErr != nil {
|
||||
@@ -108,7 +108,7 @@ CREATE TABLE schema_migrations (
|
||||
}
|
||||
}
|
||||
if !found {
|
||||
t.Fatalf("expected pre-migrate-v1-to-v2.db, got %v", names)
|
||||
t.Fatalf("expected pre-migrate-v1-to-v4.db, got %v", names)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user