mirror of
https://github.com/stalwartlabs/mail-server.git
synced 2025-09-12 06:54:34 +08:00
Migrate messages not queued for delivery
This commit is contained in:
parent
8f67fe50d8
commit
7f90cc6abc
1 changed files with 17 additions and 3 deletions
|
@ -35,7 +35,6 @@ pub(crate) async fn migrate_queue(server: &Server) -> trc::Result<()> {
|
||||||
)));
|
)));
|
||||||
|
|
||||||
let mut queue_ids = AHashSet::new();
|
let mut queue_ids = AHashSet::new();
|
||||||
|
|
||||||
server
|
server
|
||||||
.store()
|
.store()
|
||||||
.iterate(
|
.iterate(
|
||||||
|
@ -49,7 +48,22 @@ pub(crate) async fn migrate_queue(server: &Server) -> trc::Result<()> {
|
||||||
.await
|
.await
|
||||||
.caused_by(trc::location!())?;
|
.caused_by(trc::location!())?;
|
||||||
|
|
||||||
let count = queue_ids.len();
|
let from_key = ValueKey::from(ValueClass::Queue(QueueClass::Message(0)));
|
||||||
|
let to_key = ValueKey::from(ValueClass::Queue(QueueClass::Message(u64::MAX)));
|
||||||
|
server
|
||||||
|
.store()
|
||||||
|
.iterate(
|
||||||
|
IterateParams::new(from_key, to_key).ascending().no_values(),
|
||||||
|
|key, _| {
|
||||||
|
queue_ids.insert(key.deserialize_be_u64(0)?);
|
||||||
|
|
||||||
|
Ok(true)
|
||||||
|
},
|
||||||
|
)
|
||||||
|
.await
|
||||||
|
.caused_by(trc::location!())?;
|
||||||
|
|
||||||
|
let mut count = 0;
|
||||||
|
|
||||||
for queue_id in queue_ids {
|
for queue_id in queue_ids {
|
||||||
match server
|
match server
|
||||||
|
@ -96,7 +110,7 @@ pub(crate) async fn migrate_queue(server: &Server) -> trc::Result<()> {
|
||||||
.serialize()
|
.serialize()
|
||||||
.caused_by(trc::location!())?,
|
.caused_by(trc::location!())?,
|
||||||
);
|
);
|
||||||
|
count += 1;
|
||||||
server
|
server
|
||||||
.store()
|
.store()
|
||||||
.write(batch.build_all())
|
.write(batch.build_all())
|
||||||
|
|
Loading…
Add table
Reference in a new issue