Skip to content

Commit

Permalink
refactor: get EXTVERSION from Makefile on worker
Browse files Browse the repository at this point in the history
  • Loading branch information
steve-chavez committed Sep 15, 2023
1 parent 18a3c82 commit eccc9d1
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 6 deletions.
4 changes: 2 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
EXTENSION = pg_net
EXTVERSION = 0.7
EXTVERSION = 0.7.1

DATA = $(wildcard sql/*--*.sql)

Expand All @@ -21,7 +21,7 @@ PG_CONFIG = pg_config
SHLIB_LINK = -lcurl

# Find <curl/curl.h> from system headers
PG_CPPFLAGS := $(CPPFLAGS)
PG_CPPFLAGS := $(CPPFLAGS) -DEXTVERSION=\"$(EXTVERSION)\"

PGXS := $(shell $(PG_CONFIG) --pgxs)
include $(PGXS)
6 changes: 2 additions & 4 deletions src/worker.c
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,6 @@

PG_MODULE_MAGIC;

#define VERSION "0.7.1"

static char *ttl = "6 hours";
static int batch_size = 500;
char* database_name = "postgres";
Expand Down Expand Up @@ -117,7 +115,7 @@ static CURLMcode init(CURLM *cm, char *method, char *url, int timeout_millisecon
cdata->id = id;
cdata->request_headers = request_headers;

request_headers = curl_slist_append(request_headers, "User-Agent: pg_net/" VERSION);
request_headers = curl_slist_append(request_headers, "User-Agent: pg_net/" EXTVERSION);

if (strcasecmp(method, "GET") == 0) {
if (reqBody) {
Expand Down Expand Up @@ -464,7 +462,7 @@ _PG_init(void)
worker.bgw_start_time = BgWorkerStart_RecoveryFinished;
snprintf(worker.bgw_library_name, BGW_MAXLEN, "pg_net");
snprintf(worker.bgw_function_name, BGW_MAXLEN, "worker_main");
snprintf(worker.bgw_name, BGW_MAXLEN, "pg_net " VERSION " worker");
snprintf(worker.bgw_name, BGW_MAXLEN, "pg_net " EXTVERSION " worker");
worker.bgw_restart_time = 32;
worker.bgw_main_arg = (Datum) 0;
worker.bgw_notify_pid = 0;
Expand Down

0 comments on commit eccc9d1

Please sign in to comment.