Compare commits
2 commits
346920cde5
...
58b047cdb5
Author | SHA1 | Date | |
---|---|---|---|
58b047cdb5 | |||
8f95ae0058 |
5 changed files with 22 additions and 12 deletions
|
@ -7,6 +7,7 @@ repository = { workspace = true }
|
|||
description = "webhook actor for git-next, the trunk-based development manager"
|
||||
|
||||
[dependencies]
|
||||
git-next-actor-macros = { workspace = true }
|
||||
git-next-config = { workspace = true }
|
||||
git-next-repo-actor = { workspace = true }
|
||||
|
||||
|
|
1
crates/webhook-actor/src/handlers/mod.rs
Normal file
1
crates/webhook-actor/src/handlers/mod.rs
Normal file
|
@ -0,0 +1 @@
|
|||
mod shutdown_webhook;
|
13
crates/webhook-actor/src/handlers/shutdown_webhook.rs
Normal file
13
crates/webhook-actor/src/handlers/shutdown_webhook.rs
Normal file
|
@ -0,0 +1,13 @@
|
|||
//
|
||||
use actix::prelude::*;
|
||||
|
||||
use crate::{ShutdownWebhook, WebhookActor};
|
||||
|
||||
impl Handler<ShutdownWebhook> for WebhookActor {
|
||||
type Result = ();
|
||||
|
||||
fn handle(&mut self, _msg: ShutdownWebhook, ctx: &mut Self::Context) -> Self::Result {
|
||||
self.spawn_handle.take();
|
||||
ctx.stop();
|
||||
}
|
||||
}
|
|
@ -1,10 +1,13 @@
|
|||
//
|
||||
use actix::prelude::*;
|
||||
|
||||
mod handlers;
|
||||
pub mod messages;
|
||||
mod router;
|
||||
mod server;
|
||||
|
||||
use git_next_repo_actor::messages::WebhookNotification;
|
||||
pub use messages::ShutdownWebhook;
|
||||
|
||||
use std::net::SocketAddr;
|
||||
|
||||
|
@ -40,15 +43,3 @@ impl Actor for WebhookActor {
|
|||
self.spawn_handle.replace(spawn_handle);
|
||||
}
|
||||
}
|
||||
|
||||
#[derive(Debug, Message)]
|
||||
#[rtype(result = "()")]
|
||||
pub struct ShutdownWebhook;
|
||||
impl Handler<ShutdownWebhook> for WebhookActor {
|
||||
type Result = ();
|
||||
|
||||
fn handle(&mut self, _msg: ShutdownWebhook, ctx: &mut Self::Context) -> Self::Result {
|
||||
self.spawn_handle.take();
|
||||
ctx.stop();
|
||||
}
|
||||
}
|
||||
|
|
4
crates/webhook-actor/src/messages.rs
Normal file
4
crates/webhook-actor/src/messages.rs
Normal file
|
@ -0,0 +1,4 @@
|
|||
//
|
||||
use git_next_actor_macros::message;
|
||||
|
||||
message!(ShutdownWebhook: "Request to shutdown the Webhook actor");
|
Loading…
Reference in a new issue