spider

package
v0.29.2 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 17, 2025 License: Unlicense Imports: 15 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// BatchSize is the number of pubkeys per subscription batch
	BatchSize = 20
	// CatchupWindow is the extra time added to disconnection periods for catch-up
	CatchupWindow = 30 * time.Minute
	// ReconnectDelay is the initial delay between reconnection attempts
	ReconnectDelay = 10 * time.Second
	// MaxReconnectDelay is the maximum delay before switching to blackout
	MaxReconnectDelay = 1 * time.Hour
	// BlackoutPeriod is the duration to blacklist a relay after max backoff is reached
	BlackoutPeriod = 24 * time.Hour
	// BatchCreationDelay is the delay between creating each batch subscription
	BatchCreationDelay = 500 * time.Millisecond
	// RateLimitBackoffDuration is how long to wait when we get a rate limit error
	RateLimitBackoffDuration = 1 * time.Minute
	// RateLimitBackoffMultiplier is the factor by which we increase backoff on repeated rate limits
	RateLimitBackoffMultiplier = 2
	// MaxRateLimitBackoff is the maximum backoff duration for rate limiting
	MaxRateLimitBackoff = 30 * time.Minute
	// MainLoopInterval is how often the spider checks for updates
	MainLoopInterval = 5 * time.Minute
	// EventHandlerBufferSize is the buffer size for event channels
	EventHandlerBufferSize = 100
)

Variables

This section is empty.

Functions

This section is empty.

Types

type BatchSubscription added in v0.17.14

type BatchSubscription struct {
	// contains filtered or unexported fields
}

BatchSubscription represents a subscription for a batch of pubkeys

type DisconnectionPeriod added in v0.17.14

type DisconnectionPeriod struct {
	Start time.Time
	End   time.Time
}

DisconnectionPeriod tracks when a subscription was disconnected

type RelayConnection added in v0.17.14

type RelayConnection struct {
	// contains filtered or unexported fields
}

RelayConnection manages a single relay connection and its subscriptions

type Spider

type Spider struct {
	// contains filtered or unexported fields
}

Spider manages connections to admin relays and syncs events for followed pubkeys

func New

func New(ctx context.Context, db *database.D, pub publisher.I, mode string) (s *Spider, err error)

New creates a new Spider instance

func (*Spider) NotifyFollowListUpdate added in v0.29.0

func (s *Spider) NotifyFollowListUpdate()

NotifyFollowListUpdate signals the spider that the follow list has been updated

func (*Spider) SetCallbacks added in v0.17.14

func (s *Spider) SetCallbacks(getAdminRelays func() []string, getFollowList func() [][]byte)

SetCallbacks sets the callback functions for getting updated admin relays and follow lists

func (*Spider) Start

func (s *Spider) Start() (err error)

Start begins the spider operation

func (*Spider) Stop

func (s *Spider) Stop()

Stop stops the spider operation

Source Files

  • spider.go

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL