changeset 12:098d717f50ae

Change notify channel names to be unique
author Lewin Bormann <lbo@spheniscida.de>
date Tue, 01 Dec 2020 23:15:23 +0100
parents d8312d4db6a6
children 9c6ae7990f63
files Rocket.toml src/main.rs
diffstat 2 files changed, 8 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/Rocket.toml	Tue Dec 01 23:01:02 2020 +0100
+++ b/Rocket.toml	Tue Dec 01 23:15:23 2020 +0100
@@ -1,2 +1,7 @@
 [global.databases]
 geohub = { url = "postgresql://lbo:pglbo@localhost/lbo" }
+
+[production]
+log = "normal"
+address = "::1"
+port = 8000
--- a/src/main.rs	Tue Dec 01 23:01:02 2020 +0100
+++ b/src/main.rs	Tue Dec 01 23:15:23 2020 +0100
@@ -180,10 +180,10 @@
     // Otherwise we will wait for the next update.
     //
     let listen =
-        db.0.prepare_cached(format!("LISTEN {}", name).as_str())
+        db.0.prepare_cached(format!("LISTEN geohubclient_update_{}", name).as_str())
             .unwrap();
     let unlisten =
-        db.0.prepare_cached(format!("UNLISTEN {}", name).as_str())
+        db.0.prepare_cached(format!("UNLISTEN geohubclient_update_{}", name).as_str())
             .unwrap();
 
     listen.execute(&[]).ok();
@@ -282,7 +282,7 @@
     }
     let stmt = db.0.prepare_cached("INSERT INTO geohub.geodata (client, lat, long, spd, t, ele, secret) VALUES ($1, $2, $3, $4, $5, $6, public.digest($7, 'sha256'))").unwrap();
     let notify =
-        db.0.prepare_cached(format!("NOTIFY {}, '{}'", name, name).as_str())
+        db.0.prepare_cached(format!("NOTIFY geohubclient_update_{}, '{}'", name, name).as_str())
             .unwrap();
     stmt.execute(&[&name, &lat, &longitude, &s, &ts, &ele, &secret])
         .unwrap();