Some checks failed
Go / build-and-release (push) Has been cancelled
- Add Neo4j driver config options for memory management: - ORLY_NEO4J_MAX_CONN_POOL (default: 25) - connection pool size - ORLY_NEO4J_FETCH_SIZE (default: 1000) - records per batch - ORLY_NEO4J_MAX_TX_RETRY_SEC (default: 30) - transaction retry timeout - ORLY_NEO4J_QUERY_RESULT_LIMIT (default: 10000) - max results per query - Apply driver settings when creating Neo4j connection (pool size, fetch size, retry time) - Enforce query result limit as safety cap on all Cypher queries - Fix QueryForSerials and QueryForIds to preserve LIMIT clauses - Add comprehensive memory tuning documentation with sizing guidelines - Add NIP-46 signer-based authentication for bunker connections - Update go.mod with new dependencies Files modified: - app/config/config.go: Add Neo4j driver tuning config vars - main.go: Pass new config values to database factory - pkg/database/factory.go: Add Neo4j tuning fields to DatabaseConfig - pkg/database/factory_wasm.go: Mirror factory.go changes for WASM - pkg/neo4j/neo4j.go: Apply driver config, add getter methods - pkg/neo4j/query-events.go: Enforce query result limit, fix LIMIT preservation - docs/NEO4J_BACKEND.md: Add Memory Tuning section, update Docker example - CLAUDE.md: Add Neo4j memory tuning quick reference - app/handle-req.go: NIP-46 signer authentication - app/publisher.go: HasActiveNIP46Signer check - pkg/protocol/publish/publisher.go: NIP46SignerChecker interface - go.mod: Add dependencies 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
74 lines
1.6 KiB
Go
74 lines
1.6 KiB
Go
package publish
|
|
|
|
import (
|
|
"time"
|
|
|
|
"github.com/gorilla/websocket"
|
|
"git.mleku.dev/mleku/nostr/encoders/event"
|
|
"next.orly.dev/pkg/interfaces/publisher"
|
|
"next.orly.dev/pkg/interfaces/typer"
|
|
)
|
|
|
|
// WriteRequest represents a write operation to be performed by the write worker
|
|
type WriteRequest struct {
|
|
Data []byte
|
|
MsgType int
|
|
IsControl bool
|
|
Deadline time.Time
|
|
IsPing bool // Special marker for ping messages
|
|
}
|
|
|
|
// WriteChanSetter defines the interface for setting write channels
|
|
type WriteChanSetter interface {
|
|
SetWriteChan(*websocket.Conn, chan WriteRequest)
|
|
GetWriteChan(*websocket.Conn) (chan WriteRequest, bool)
|
|
}
|
|
|
|
// NIP46SignerChecker defines the interface for checking active NIP-46 signers
|
|
type NIP46SignerChecker interface {
|
|
HasActiveNIP46Signer(signerPubkey []byte) bool
|
|
}
|
|
|
|
// S is the control structure for the subscription management scheme.
|
|
type S struct {
|
|
publisher.Publishers
|
|
}
|
|
|
|
// New creates a new publish.S.
|
|
func New(p ...publisher.I) (s *S) {
|
|
s = &S{Publishers: p}
|
|
return
|
|
}
|
|
|
|
var _ publisher.I = &S{}
|
|
|
|
func (s *S) Type() string { return "publish" }
|
|
|
|
func (s *S) Deliver(ev *event.E) {
|
|
for _, p := range s.Publishers {
|
|
p.Deliver(ev)
|
|
}
|
|
}
|
|
|
|
func (s *S) Receive(msg typer.T) {
|
|
t := msg.Type()
|
|
for _, p := range s.Publishers {
|
|
if p.Type() == t {
|
|
p.Receive(msg)
|
|
return
|
|
}
|
|
}
|
|
}
|
|
|
|
// GetSocketPublisher returns the socketapi publisher instance
|
|
func (s *S) GetSocketPublisher() WriteChanSetter {
|
|
for _, p := range s.Publishers {
|
|
if p.Type() == "socketapi" {
|
|
if socketPub, ok := p.(WriteChanSetter); ok {
|
|
return socketPub
|
|
}
|
|
}
|
|
}
|
|
return nil
|
|
}
|