mirror of
https://git.asonix.dog/asonix/background-jobs.git
synced 2024-11-22 03:51:00 +00:00
core: Improve tracing
This commit is contained in:
parent
d276aa2cfe
commit
1a835863d4
2 changed files with 4 additions and 1 deletions
|
@ -192,7 +192,7 @@ where
|
||||||
span.record("exception.message", &tracing::field::display(&display));
|
span.record("exception.message", &tracing::field::display(&display));
|
||||||
span.record("exception.details", &tracing::field::display(&debug));
|
span.record("exception.details", &tracing::field::display(&debug));
|
||||||
#[cfg(feature = "error-logging")]
|
#[cfg(feature = "error-logging")]
|
||||||
tracing::warn!("Job errored: {:?}", e);
|
tracing::warn!("Job errored");
|
||||||
ReturnJobInfo::fail(id)
|
ReturnJobInfo::fail(id)
|
||||||
}
|
}
|
||||||
Err(_) => {
|
Err(_) => {
|
||||||
|
|
|
@ -200,6 +200,7 @@ pub mod memory_storage {
|
||||||
self.inner.lock().unwrap().jobs.get(id).cloned()
|
self.inner.lock().unwrap().jobs.get(id).cloned()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[tracing::instrument(skip(self))]
|
||||||
fn try_deque(&self, queue: &str, now: SystemTime) -> Option<JobInfo> {
|
fn try_deque(&self, queue: &str, now: SystemTime) -> Option<JobInfo> {
|
||||||
let mut inner = self.inner.lock().unwrap();
|
let mut inner = self.inner.lock().unwrap();
|
||||||
|
|
||||||
|
@ -223,6 +224,7 @@ pub mod memory_storage {
|
||||||
None
|
None
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[tracing::instrument(skip(self))]
|
||||||
fn listener(&self, queue: &str, now: SystemTime) -> (Duration, EventListener) {
|
fn listener(&self, queue: &str, now: SystemTime) -> (Duration, EventListener) {
|
||||||
let mut inner = self.inner.lock().unwrap();
|
let mut inner = self.inner.lock().unwrap();
|
||||||
|
|
||||||
|
@ -321,6 +323,7 @@ pub mod memory_storage {
|
||||||
if duration > Duration::from_secs(0) {
|
if duration > Duration::from_secs(0) {
|
||||||
let _ = self.timer.timeout(duration, listener).await;
|
let _ = self.timer.timeout(duration, listener).await;
|
||||||
}
|
}
|
||||||
|
tracing::debug!("Finished waiting, trying dequeue");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue