refactor: 🔨 remove comments about callbacks
This commit is contained in:
parent
7849458963
commit
b35cbe95ee
@ -319,24 +319,8 @@ pub trait Rustler: RustlerAccessor + Send + Sync {
|
||||
/// should be called after the status of the rustler changes
|
||||
fn handle_status_change(&mut self) -> Result<()> {
|
||||
match self.status() {
|
||||
RustlerStatus::Disconnected => {
|
||||
self.set_last_stop(Some(Local::now()));
|
||||
|
||||
// if let Some(callbacks) = self.callbacks() {
|
||||
// if let Some(on_disconnected) = callbacks.on_disconnected {
|
||||
// on_disconnected()?;
|
||||
// }
|
||||
// }
|
||||
}
|
||||
RustlerStatus::Connected => {
|
||||
self.set_last_run(Some(Local::now()));
|
||||
|
||||
// if let Some(callbacks) = self.callbacks() {
|
||||
// if let Some(on_connected) = callbacks.on_connected {
|
||||
// on_connected()?;
|
||||
// }
|
||||
// }
|
||||
}
|
||||
RustlerStatus::Disconnected => self.set_last_stop(Some(Local::now())),
|
||||
RustlerStatus::Connected => self.set_last_run(Some(Local::now())),
|
||||
_ => {}
|
||||
};
|
||||
|
||||
@ -433,6 +417,11 @@ macro_rules! rustler_accessors {
|
||||
fn next_run(&self) -> &$crate::rustlers::chrono::DateTime<$crate::rustlers::chrono::Local> {
|
||||
&self.next_run
|
||||
}
|
||||
// TODO: Instead of next_run and next_stop, store the scheduling rules
|
||||
// we can calculate the next run and next stop times from the rules, and will also be
|
||||
// useful to decide if we should recover from a disconnection or not (we should only
|
||||
// recover if the rules say we should be connected at the current time, otherwise we
|
||||
// should stay disconnected, even if it was an abnormal disconnection)
|
||||
fn set_next_run(
|
||||
&mut self,
|
||||
next_run: $crate::rustlers::chrono::DateTime<$crate::rustlers::chrono::Local>,
|
||||
|
||||
@ -112,6 +112,11 @@ where
|
||||
let mut publisher = self.publisher.clone();
|
||||
while let Some(msg) = receiver.recv().await {
|
||||
match msg {
|
||||
// TODO: if we want to restart a dead rustler, we should listen for a restart
|
||||
// signal here and restart the rustler. The restart signal does not exist
|
||||
// yet, so we will need to implement it and send it from rustlers when
|
||||
// it makes sense to restart them (when we are sure we are not going to
|
||||
// keep listening for quotes from the source feed, for example)
|
||||
RustlerMsg::QuoteMsg(quote) => publisher.publish(quote).await?,
|
||||
}
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user