mirror of
https://github.com/grassrootseconomics/cic-custodial.git
synced 2026-05-14 00:28:44 +02:00
refactor: remove unecessary publisher component
* clients should now rely on the CHAIn.* subjects
This commit is contained in:
@@ -3,14 +3,12 @@ package main
|
||||
import (
|
||||
"context"
|
||||
"strings"
|
||||
"time"
|
||||
|
||||
"github.com/bsm/redislock"
|
||||
"github.com/grassrootseconomics/celoutils"
|
||||
"github.com/grassrootseconomics/cic-custodial/internal/custodial"
|
||||
"github.com/grassrootseconomics/cic-custodial/internal/keystore"
|
||||
"github.com/grassrootseconomics/cic-custodial/internal/nonce"
|
||||
"github.com/grassrootseconomics/cic-custodial/internal/pub"
|
||||
"github.com/grassrootseconomics/cic-custodial/internal/queries"
|
||||
"github.com/grassrootseconomics/cic-custodial/internal/store"
|
||||
"github.com/grassrootseconomics/cic-custodial/internal/sub"
|
||||
@@ -159,7 +157,7 @@ func initPostgresKeystore(postgresPool *pgxpool.Pool, queries *queries.Queries)
|
||||
// Load redis backed noncestore.
|
||||
func initRedisNoncestore(redisPool *redis.RedisPool) nonce.Noncestore {
|
||||
return nonce.NewRedisNoncestore(nonce.Opts{
|
||||
RedisPool: redisPool,
|
||||
RedisPool: redisPool,
|
||||
})
|
||||
}
|
||||
|
||||
@@ -199,19 +197,6 @@ func initJetStream() (*nats.Conn, nats.JetStreamContext) {
|
||||
return natsConn, js
|
||||
}
|
||||
|
||||
func initPub(jsCtx nats.JetStreamContext) *pub.Pub {
|
||||
pub, err := pub.NewPub(pub.PubOpts{
|
||||
DedupDuration: time.Duration(ko.MustInt("jetstream.dedup_duration_hrs")) * time.Hour,
|
||||
JsCtx: jsCtx,
|
||||
PersistDuration: time.Duration(ko.MustInt("jetstream.persist_duration_hrs")) * time.Hour,
|
||||
})
|
||||
if err != nil {
|
||||
lo.Fatal("init: critical error bootstrapping pub", "error", err)
|
||||
}
|
||||
|
||||
return pub
|
||||
}
|
||||
|
||||
func initSub(natsConn *nats.Conn, jsCtx nats.JetStreamContext, cu *custodial.Custodial) *sub.Sub {
|
||||
sub, err := sub.NewSub(sub.SubOpts{
|
||||
CustodialContainer: cu,
|
||||
|
||||
@@ -59,7 +59,6 @@ func main() {
|
||||
taskerClient := initTaskerClient(asynqRedisPool)
|
||||
|
||||
natsConn, jsCtx := initJetStream()
|
||||
jsPub := initPub(jsCtx)
|
||||
|
||||
custodial, err := custodial.NewCustodial(custodial.Opts{
|
||||
CeloProvider: celoProvider,
|
||||
@@ -67,7 +66,6 @@ func main() {
|
||||
LockProvider: lockProvider,
|
||||
Noncestore: redisNoncestore,
|
||||
PgStore: pgStore,
|
||||
Pub: jsPub,
|
||||
RedisClient: redisPool.Client,
|
||||
RegistryAddress: ko.MustString("chain.registry_address"),
|
||||
SystemPrivateKey: ko.MustString("system.private_key"),
|
||||
|
||||
Reference in New Issue
Block a user