Put activities generated by CLI commands in a queue

This commit is contained in:
silverpill 2023-02-25 16:37:24 +00:00
parent 49f51f44d8
commit 0f3c247069
3 changed files with 8 additions and 4 deletions

View file

@ -13,6 +13,10 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).
- Added `federation` parameter group to configuration.
- Add empty `spoiler_text` property to Mastodon API Status object.
### Changed
- Put activities generated by CLI commands in a queue instead of immediately sending them.
### Deprecated
- Deprecated `proxy_url` configuration parameter (replaced by `federation.proxy_url`).

View file

@ -244,7 +244,7 @@ impl DeleteProfile {
deletion_queue.process(config).await;
// Send Delete(Person) activities
if let Some(activity) = maybe_delete_person {
activity.deliver().await?;
activity.enqueue(db_client).await?;
};
println!("profile deleted");
Ok(())
@ -279,7 +279,7 @@ impl DeletePost {
deletion_queue.process(config).await;
// Send Delete(Note) activity
if let Some(activity) = maybe_delete_note {
activity.deliver().await?;
activity.enqueue(db_client).await?;
};
println!("post deleted");
Ok(())

View file

@ -252,7 +252,7 @@ impl OutgoingActivity {
}
}
pub async fn deliver(
pub(super) async fn deliver(
self,
) -> Result<(), DelivererError> {
deliver_activity_worker(
@ -264,7 +264,7 @@ impl OutgoingActivity {
).await
}
pub fn spawn_deliver(self) -> () {
pub(super) fn spawn_deliver(self) -> () {
tokio::spawn(async move {
self.deliver().await.unwrap_or_else(|err| {
log::error!("{}", err);