Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions packages/core/services/build/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ edition.workspace = true
acme-lib = "0.9"
anyhow = "1.0"
chirp-workflow.workspace = true
cjson = "0.1"
cloudflare.workspace = true
heck = "0.3"
http = "0.2"
Expand Down
24 changes: 14 additions & 10 deletions packages/core/services/build/src/ops/resolve_for_tags.rs
Original file line number Diff line number Diff line change
Expand Up @@ -19,29 +19,33 @@ pub struct Output {

#[operation]
pub async fn build_resolve_for_tags(ctx: &OperationCtx, input: &Input) -> GlobalResult<Output> {
let tags_str = serde_json::to_string(&input.tags)?;
let tags_str = unwrap!(cjson::to_string(&input.tags));

let builds = if input.bypass_cache {
get_builds(&ctx, input.env_id, &tags_str).await?
} else {
unwrap!(
ctx.cache()
.ttl(util::duration::seconds(15))
.fetch_one_json("build", tags_str.as_str(), {
let ctx = ctx.clone();
let tags_str = tags_str.clone();
move |mut cache, key| {
.fetch_one_json(
"build",
format!("{}:{}", input.env_id, tags_str.as_str()),
{
let ctx = ctx.clone();
let tags_str = tags_str.clone();
async move {
let builds = get_builds(&ctx, input.env_id, &tags_str).await?;
move |mut cache, key| {
let ctx = ctx.clone();
let tags_str = tags_str.clone();
async move {
let builds = get_builds(&ctx, input.env_id, &tags_str).await?;

cache.resolve(&key, builds);
cache.resolve(&key, builds);

Ok(cache)
Ok(cache)
}
}
}
})
)
.await?
)
};
Expand Down
Loading