tangled
alpha
login
or
join now
eldridge.cam
/
cartography
0
fork
atom
Trading card city builder game?
0
fork
atom
overview
issues
pulls
pipelines
remove more notifications code
eldridge.cam
1 month ago
7a599a15
c1cf38da
0/2
gleam-ci.yaml
timeout
19m 9s
svelte-ci.yaml
timeout
20m 2s
+2
-17
3 changed files
expand all
collapse all
unified
split
server
src
server
context.gleam
server.gleam
websocket
state.gleam
+1
-12
server/src/server.gleam
reviewed
···
30
30
|> pog.pool_size(10)
31
31
|> pog.supervised()
32
32
33
33
-
let notifications_name = process.new_name("notifications")
34
34
-
let assert Ok(db_config) = pog.url_config(notifications_name, database_url)
35
35
-
let database_notifications =
36
36
-
db_config
37
37
-
|> pog.notifications_supervised()
38
38
-
39
39
-
let context =
40
40
-
context.Context(
41
41
-
db_name,
42
42
-
pog.named_notifications_connection(notifications_name),
43
43
-
)
33
33
+
let context = context.Context(db_name)
44
34
let server =
45
35
mist.new(fn(req) { router.handler(req, context) })
46
36
|> mist.port(port)
···
49
39
let assert Ok(_) =
50
40
sup.new(sup.OneForOne)
51
41
|> sup.add(database)
52
52
-
|> sup.add(database_notifications)
53
42
|> sup.add(server)
54
43
|> sup.start()
55
44
+1
-1
server/src/server/context.gleam
reviewed
···
2
2
import pog
3
3
4
4
pub type Context {
5
5
-
Context(db: Name(pog.Message), notifications: pog.NotificationsConnection)
5
5
+
Context(db: Name(pog.Message))
6
6
}
-4
server/src/websocket/state.gleam
reviewed
···
33
33
pog.named_connection(state.context.db)
34
34
}
35
35
36
36
-
pub fn notifications_connection(state: State) -> pog.NotificationsConnection {
37
37
-
state.context.notifications
38
38
-
}
39
39
-
40
36
pub fn add_listener(
41
37
state: State,
42
38
channel: String,