Skip to content

Commit aa7e6f8

Browse files
authored
feat(admin): explicit notify on gc endpoint (#2067)
1 parent d3d92f1 commit aa7e6f8

File tree

2 files changed

+15
-16
lines changed

2 files changed

+15
-16
lines changed

admin/src/client.rs

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -145,8 +145,15 @@ impl Client {
145145
self.inner.get_json(&path).await
146146
}
147147

148-
pub async fn stop_gc_inactive_project(&self, project_id: &str) -> Result<ParsedJson<String>> {
149-
let path = format!("/admin/gc/stop-inactive-project/{project_id}");
148+
pub async fn stop_gc_inactive_project(
149+
&self,
150+
project_id: &str,
151+
notify: bool,
152+
) -> Result<ParsedJson<String>> {
153+
let path = format!(
154+
"/admin/gc/stop-inactive-project/{project_id}{}",
155+
if notify { "?notify=true" } else { "" }
156+
);
150157
self.inner.put_json(&path, Option::<()>::None).await
151158
}
152159

admin/src/lib.rs

Lines changed: 6 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -247,23 +247,15 @@ async fn gc(
247247
let mut any_error = false;
248248
for pid in project_ids {
249249
println!("{pid}");
250-
let call = if send_email {
251-
client
252-
.stop_gc_inactive_project(&pid)
253-
.await
254-
.map(|r| r.into_inner())
255-
} else {
250+
println!(
251+
" {:?}",
256252
client
257-
.inner
258-
.stop_service(&pid)
253+
.stop_gc_inactive_project(&pid, send_email)
259254
.await
260255
.map(|r| r.into_inner())
261-
};
262-
println!(
263-
" {:?}",
264-
call.inspect_err(|_| {
265-
any_error = true;
266-
})
256+
.inspect_err(|_| {
257+
any_error = true;
258+
})
267259
);
268260
// prevent api rate limiting
269261
tokio::time::sleep(tokio::time::Duration::from_millis(1000)).await;

0 commit comments

Comments
 (0)