mirror of
https://github.com/windmill-labs/windmill.git
synced 2026-09-06 00:02:13 +00:00
fix warnings
This commit is contained in:
@@ -2851,7 +2851,7 @@ async fn test_script_schedule_handlers(db: Pool<Postgres>) {
|
||||
let now = chrono::Utc::now();
|
||||
// add 5 seconds to now
|
||||
let then = now
|
||||
.checked_add_signed(chrono::Duration::seconds(5))
|
||||
.checked_add_signed(chrono::Duration::try_seconds(5).unwrap())
|
||||
.unwrap();
|
||||
|
||||
let schedule = NewSchedule {
|
||||
@@ -2916,7 +2916,7 @@ async fn test_script_schedule_handlers(db: Pool<Postgres>) {
|
||||
args.insert("fail".to_string(), json!(false));
|
||||
let now = chrono::Utc::now();
|
||||
let then = now
|
||||
.checked_add_signed(chrono::Duration::seconds(5))
|
||||
.checked_add_signed(chrono::Duration::try_seconds(5).unwrap())
|
||||
.unwrap();
|
||||
client
|
||||
.update_schedule(
|
||||
@@ -2995,7 +2995,7 @@ async fn test_flow_schedule_handlers(db: Pool<Postgres>) {
|
||||
let now = chrono::Utc::now();
|
||||
// add 5 seconds to now
|
||||
let then = now
|
||||
.checked_add_signed(chrono::Duration::seconds(5))
|
||||
.checked_add_signed(chrono::Duration::try_seconds(5).unwrap())
|
||||
.unwrap();
|
||||
|
||||
let schedule = NewSchedule {
|
||||
@@ -3061,7 +3061,7 @@ async fn test_flow_schedule_handlers(db: Pool<Postgres>) {
|
||||
args.insert("fail".to_string(), json!(false));
|
||||
let now = chrono::Utc::now();
|
||||
let then = now
|
||||
.checked_add_signed(chrono::Duration::seconds(5))
|
||||
.checked_add_signed(chrono::Duration::try_seconds(5).unwrap())
|
||||
.unwrap();
|
||||
client
|
||||
.update_schedule(
|
||||
|
||||
@@ -660,7 +660,9 @@ impl RunJobQuery {
|
||||
Ok(Some(scheduled_for))
|
||||
} else if let Some(scheduled_in_secs) = self.scheduled_in_secs {
|
||||
let now = now_from_db(db).await?;
|
||||
Ok(Some(now + chrono::Duration::seconds(scheduled_in_secs)))
|
||||
Ok(Some(
|
||||
now + chrono::Duration::try_seconds(scheduled_in_secs).unwrap_or_default(),
|
||||
))
|
||||
} else {
|
||||
Ok(None)
|
||||
}
|
||||
|
||||
@@ -305,7 +305,8 @@ impl AuthCache {
|
||||
key,
|
||||
ExpiringAuthCache {
|
||||
authed: authed.clone(),
|
||||
expiry: chrono::Utc::now() + chrono::Duration::seconds(120),
|
||||
expiry: chrono::Utc::now()
|
||||
+ chrono::Duration::try_seconds(120).unwrap(),
|
||||
},
|
||||
);
|
||||
}
|
||||
|
||||
@@ -777,8 +777,8 @@ pub async fn add_completed_job<
|
||||
.num_seconds()
|
||||
< 10
|
||||
{
|
||||
let next_run =
|
||||
queued_job.started_at.unwrap_or(now) + chrono::Duration::seconds(10);
|
||||
let next_run = queued_job.started_at.unwrap_or(now)
|
||||
+ chrono::Duration::try_seconds(10).unwrap();
|
||||
tracing::warn!("Perpetual script {:?} is running too fast, only 1 job per 10s it supported. Scheduling next run for {:?}", queued_job.script_path, next_run);
|
||||
Some(next_run)
|
||||
} else {
|
||||
@@ -1642,8 +1642,10 @@ pub async fn pull<R: rsmq_async::RsmqConnection + Send + Clone>(
|
||||
|
||||
// optimal scheduling is: 'older_job_in_concurrency_time_window_started_timestamp + script_avg_duration + concurrency_time_window_s'
|
||||
let estimated_next_schedule_timestamp = min_started_at.unwrap_or(pulled_job.scheduled_for)
|
||||
+ Duration::seconds(avg_script_duration.map(i64::from).unwrap_or(0))
|
||||
+ Duration::seconds(i64::from(job_custom_concurrency_time_window_s));
|
||||
+ Duration::try_seconds(avg_script_duration.map(i64::from).unwrap_or(0))
|
||||
.unwrap_or_default()
|
||||
+ Duration::try_seconds(i64::from(job_custom_concurrency_time_window_s))
|
||||
.unwrap_or_default();
|
||||
tracing::info!("Job '{}' from path '{}' with concurrency key '{}' has reached its concurrency limit of {} jobs run in the last {} seconds. This job will be re-queued for next execution at {}",
|
||||
job_uuid, job_script_path, job_custom_concurrent_limit, job_concurrency_key, job_custom_concurrency_time_window_s, estimated_next_schedule_timestamp);
|
||||
|
||||
|
||||
@@ -119,7 +119,7 @@ pub async fn do_snowflake(
|
||||
iss: iss,
|
||||
sub: qualified_username,
|
||||
iat: chrono::Utc::now().timestamp(),
|
||||
exp: (chrono::Utc::now() + chrono::Duration::hours(1)).timestamp(),
|
||||
exp: (chrono::Utc::now() + chrono::Duration::try_hours(1).unwrap()).timestamp(),
|
||||
};
|
||||
|
||||
let private_key = EncodingKey::from_rsa_pem(database.private_key.as_bytes()).map_err(|e| {
|
||||
|
||||
Reference in New Issue
Block a user