Skip to content

Commit

Permalink
refactor: background worker logic into functions
Browse files Browse the repository at this point in the history
This way the logic is easier to understand, essentially:

```
delete_expired_responses(guc_ttl);
consume_request_queue(curl_mhandle);
insert_curl_responses(curl_mhandle);
```

Also cleanups tabs and instead uses two spaces for indentation.
  • Loading branch information
steve-chavez committed Jul 17, 2024
1 parent 47e3c1a commit a6da975
Show file tree
Hide file tree
Showing 2 changed files with 431 additions and 440 deletions.
19 changes: 19 additions & 0 deletions src/util.h
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,25 @@

#include <utils/jsonb.h>

#define CURL_EZ_SETOPT(hdl, opt, prm) \
do { \
if (curl_easy_setopt(hdl, opt, prm) != CURLE_OK) \
ereport(ERROR, errmsg("Could not curl_easy_setopt(%s)", #opt)); \
} while (0)

#define CURL_EZ_GETINFO(hdl, opt, prm) \
do { \
if (curl_easy_getinfo(hdl, opt, prm) != CURLE_OK) \
ereport(ERROR, errmsg("Could not curl_easy_getinfo(%s)", #opt)); \
} while (0)

#define EREPORT_NULL_ATTR(tupIsNull, attr) \
do { \
if (tupIsNull) \
ereport(ERROR, errmsg("%s cannot be null", #attr)); \
} while (0)


extern struct curl_slist *pg_text_array_to_slist(ArrayType *array,
struct curl_slist *headers);
extern void parseHeaders(char *contents, JsonbParseState *headers);
Expand Down
Loading

0 comments on commit a6da975

Please sign in to comment.