Skip to content

Commit

Permalink
Fmt
Browse files Browse the repository at this point in the history
  • Loading branch information
augustuswm committed Nov 2, 2023
1 parent 9c93071 commit 4130439
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 9 deletions.
7 changes: 6 additions & 1 deletion rfd-model/src/storage/postgres.rs
Original file line number Diff line number Diff line change
Expand Up @@ -430,7 +430,12 @@ impl JobStore for PostgresStore {
) -> Result<Vec<Job>, StoreError> {
let mut query = job::dsl::job.into_boxed();

let JobFilter { id, sha, processed, started } = filter;
let JobFilter {
id,
sha,
processed,
started,
} = filter;

if let Some(id) = id {
query = query.filter(job::id.eq_any(id));
Expand Down
19 changes: 11 additions & 8 deletions rfd-processor/src/processor.rs
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,9 @@ pub async fn processor(ctx: Arc<Context>) -> Result<(), JobError> {
loop {
let jobs = JobStore::list(
&ctx.db.storage,
JobFilter::default().processed(Some(false)).started(Some(false)),
JobFilter::default()
.processed(Some(false))
.started(Some(false)),
&pagination,
)
.await?;
Expand All @@ -36,7 +38,6 @@ pub async fn processor(ctx: Arc<Context>) -> Result<(), JobError> {
// Make the job as started
match JobStore::start(&ctx.db.storage, job.id).await {
Ok(Some(job)) => {

let location = GitHubRfdLocation {
owner: job.owner.clone(),
repo: job.repository.clone(),
Expand All @@ -55,11 +56,9 @@ pub async fn processor(ctx: Arc<Context>) -> Result<(), JobError> {

match updater.handle(&ctx, &[update]).await {
Ok(_) => {
let _ = JobStore::complete(&ctx.db.storage, job.id)
.await
.tap_err(|err| {
tracing::error!(?err, "Failed to mark job as completed")
});
let _ = JobStore::complete(&ctx.db.storage, job.id).await.tap_err(
|err| tracing::error!(?err, "Failed to mark job as completed"),
);
}
Err(err) => {
tracing::error!(?err, "RFD update failed");
Expand All @@ -72,7 +71,11 @@ pub async fn processor(ctx: Arc<Context>) -> Result<(), JobError> {
tracing::error!(?job, "Job that was scheduled to run has gone missing! Was it started by a different task?");
}
Err(err) => {
tracing::warn!(?job, ?err, "Failed to start job. Was it previously started?");
tracing::warn!(
?job,
?err,
"Failed to start job. Was it previously started?"
);
}
}

Expand Down

0 comments on commit 4130439

Please sign in to comment.