Skip to content

Commit 5791642

Browse files
authored
Merge pull request #68 from IBM/pre-8.0.3
fix: Modify scheduler to align better with schedule lib update
2 parents ae73574 + fd5f694 commit 5791642

File tree

4 files changed

+39
-47
lines changed

4 files changed

+39
-47
lines changed

charts/core-dump-handler/Chart.yaml

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,9 @@ sources:
1010

1111
type: application
1212

13-
version: v8.0.2
13+
version: v8.0.3
1414

15-
appVersion: "v8.0.2"
15+
appVersion: "v8.0.3"
1616

1717
icon: https://raw.githubusercontent.com/No9/core-dump-handler/master/assets/handle-with-care-svgrepo-com.svg
1818

@@ -33,10 +33,12 @@ annotations:
3333
description: Fix template quote
3434
links:
3535
- name: Github PR
36-
url: https://github.com/IBM/core-dump-handler/pull/67
36+
url: https://github.com/IBM/core-dump-handler/pull/68
37+
- name: Github Issue
38+
url: https://github.com/IBM/core-dump-handler/issues/65
3739
artifacthub.io/images: |
3840
- name: core-dump-handler
39-
image: quay.io/repository/icdh/core-dump-handler:v8.0.2
41+
image: quay.io/repository/icdh/core-dump-handler:v8.0.3
4042
artifacthub.io/license: MIT
4143
artifacthub.io/signKey: |
4244
fingerprint: BED079E67FD431E45301B1C9949E671B46AC8A34

charts/core-dump-handler/values.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ replicaCount: 1
33
image:
44
registry: quay.io
55
repository: icdh/core-dump-handler
6-
tag: v8.0.2
6+
tag: v8.0.3
77
pullPolicy: Always
88
pullSecrets: []
99
request_mem: "64Mi"

core-dump-agent/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
name = "core-dump-agent"
3-
version = "8.0.0"
3+
version = "8.0.3"
44
authors = ["Anthony Whalley <[email protected]>"]
55
edition = "2021"
66

core-dump-agent/src/main.rs

Lines changed: 31 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ extern crate s3;
44
use advisory_lock::{AdvisoryFileLock, FileLockMode};
55
use env_logger::Env;
66
use inotify::{EventMask, Inotify, WatchMask};
7-
use log::{debug, error, info, warn};
7+
use log::{error, info, warn};
88
use s3::bucket::Bucket;
99
use s3::creds::Credentials;
1010
use s3::region::Region;
@@ -164,7 +164,7 @@ async fn main() -> Result<(), anyhow::Error> {
164164
interval, schedule, interval
165165
);
166166
}
167-
// Overwriting the schedule string if interval present
167+
168168
if !interval.is_empty() {
169169
let mut i_interval = match interval.parse::<u64>() {
170170
Ok(v) => v,
@@ -179,49 +179,39 @@ async fn main() -> Result<(), anyhow::Error> {
179179
warn!("Both schedule and INotify set. Running schedule")
180180
}
181181
}
182-
//Need to clone here before it gets borrowed
182+
183183
let notify_location = core_location.clone();
184-
let schedule_task;
185184
if !schedule.is_empty() {
186-
info!("Schedule is Starting...");
187-
schedule_task = tokio::spawn(async move {
188-
info!("Schedule Initialising with: {}", schedule);
189-
let mut sched = JobScheduler::new();
190-
let s_job = match Job::new(schedule.as_str(), move |_uuid, _l| {
191-
let handle = Handle::current();
192-
let core_str = core_location.clone();
193-
handle.spawn(async move {
194-
run_polling_agent(&core_str).await;
195-
});
196-
}) {
197-
Ok(v) => v,
198-
Err(e) => {
199-
error!("Schedule Job Creation with {} failed, {}", schedule, e);
200-
panic!("Schedule Job Creation with {} failed, {}", schedule, e)
201-
}
202-
};
203-
info!("Created Schedule job: {:?}", s_job.guid());
204-
match sched.add(s_job) {
205-
Ok(v) => v,
206-
Err(e) => {
207-
error!("Job Add failed {:#?}", e);
208-
panic!("Job Scheduing failed, {:#?}", e)
209-
}
185+
info!("Schedule Initialising with: {}", schedule);
186+
let mut sched = JobScheduler::new();
187+
let s_job = match Job::new(schedule.as_str(), move |_uuid, _l| {
188+
let handle = Handle::current();
189+
let core_str = core_location.clone();
190+
handle.spawn(async move {
191+
run_polling_agent(&core_str).await;
192+
});
193+
}) {
194+
Ok(v) => v,
195+
Err(e) => {
196+
error!("Schedule Job Creation with {} failed, {}", schedule, e);
197+
panic!("Schedule Job Creation with {} failed, {}", schedule, e)
210198
}
211-
info!("Added Job to Schedule");
212-
loop {
213-
match sched.tick() {
214-
Ok(_) => {
215-
debug!("Executed tick");
216-
}
217-
Err(e) => {
218-
error!("Job Tick failed {:#?}", e);
219-
}
220-
};
221-
std::thread::sleep(Duration::from_millis(500));
199+
};
200+
info!("Created Schedule job: {:?}", s_job.guid());
201+
match sched.add(s_job) {
202+
Ok(v) => v,
203+
Err(e) => {
204+
error!("Job Add failed {:#?}", e);
205+
panic!("Job Scheduing failed, {:#?}", e)
222206
}
223-
});
224-
schedule_task.await?;
207+
}
208+
match sched.start().await {
209+
Ok(v) => v,
210+
Err(e) => {
211+
error!("Schedule Start failed {:#?}", e);
212+
panic!("Schedule Start failed, {:#?}", e)
213+
}
214+
};
225215
}
226216

227217
if use_inotify == "true" {

0 commit comments

Comments
 (0)