fix(fc_writer): handle 409 Conflict by fetching existing slot details via GET

This commit is contained in:
Wild Dragon Dev 2026-06-04 01:12:06 +00:00
parent 5b72ee167d
commit cc489f7774

View file

@ -196,8 +196,15 @@ fc_writer_t *fc_writer_open(const char *fc_url,
char resp[1024] = {0}; char resp[1024] = {0};
int status = http_request("POST", host, port, "/slots", body, resp, sizeof resp); int status = http_request("POST", host, port, "/slots", body, resp, sizeof resp);
if (status != 201) { if (status == 409) {
fprintf(stderr, "[fc_writer:%s] POST /slots failed (HTTP %d): %s\n", /* Already exists, fetch slot details */
char path[256];
snprintf(path, sizeof path, "/slots/%s", slot_id);
status = http_request("GET", host, port, path, NULL, resp, sizeof resp);
}
if (status != 200 && status != 201) {
fprintf(stderr, "[fc_writer:%s] POST/GET /slots failed (HTTP %d): %s\n",
slot_id, status, resp); slot_id, status, resp);
return NULL; return NULL;
} }