Skip to content

Commit eccc9d1

Browse files
committed
refactor: get EXTVERSION from Makefile on worker
1 parent 18a3c82 commit eccc9d1

File tree

2 files changed

+4
-6
lines changed

2 files changed

+4
-6
lines changed

Makefile

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
EXTENSION = pg_net
2-
EXTVERSION = 0.7
2+
EXTVERSION = 0.7.1
33

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

@@ -21,7 +21,7 @@ PG_CONFIG = pg_config
2121
SHLIB_LINK = -lcurl
2222

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

2626
PGXS := $(shell $(PG_CONFIG) --pgxs)
2727
include $(PGXS)

src/worker.c

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -34,8 +34,6 @@
3434

3535
PG_MODULE_MAGIC;
3636

37-
#define VERSION "0.7.1"
38-
3937
static char *ttl = "6 hours";
4038
static int batch_size = 500;
4139
char* database_name = "postgres";
@@ -117,7 +115,7 @@ static CURLMcode init(CURLM *cm, char *method, char *url, int timeout_millisecon
117115
cdata->id = id;
118116
cdata->request_headers = request_headers;
119117

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

122120
if (strcasecmp(method, "GET") == 0) {
123121
if (reqBody) {
@@ -464,7 +462,7 @@ _PG_init(void)
464462
worker.bgw_start_time = BgWorkerStart_RecoveryFinished;
465463
snprintf(worker.bgw_library_name, BGW_MAXLEN, "pg_net");
466464
snprintf(worker.bgw_function_name, BGW_MAXLEN, "worker_main");
467-
snprintf(worker.bgw_name, BGW_MAXLEN, "pg_net " VERSION " worker");
465+
snprintf(worker.bgw_name, BGW_MAXLEN, "pg_net " EXTVERSION " worker");
468466
worker.bgw_restart_time = 32;
469467
worker.bgw_main_arg = (Datum) 0;
470468
worker.bgw_notify_pid = 0;

0 commit comments

Comments
 (0)