Skip to content

Commit

Permalink
fix: dispatch_timeout and heartbeat
Browse files Browse the repository at this point in the history
  • Loading branch information
dunglas committed Apr 20, 2023
1 parent f64e644 commit 86a6f5f
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
2 changes: 1 addition & 1 deletion caddy/caddy.go
Expand Up @@ -63,7 +63,7 @@ type Mercure struct {
// Maximum duration before closing the connection, defaults to 600s, set to 0 to disable.
WriteTimeout *caddy.Duration `json:"write_timeout,omitempty"`

// Maximum dispatch duration of an update.
// Maximum dispatch duration of an update, defaults to 5s.
DispatchTimeout *caddy.Duration `json:"dispatch_timeout,omitempty"`

// Frequency of the heartbeat, defaults to 40s.
Expand Down
6 changes: 5 additions & 1 deletion hub.go
Expand Up @@ -284,7 +284,11 @@ type Hub struct {

// NewHub creates a new Hub instance.
func NewHub(options ...Option) (*Hub, error) {
opt := &opt{writeTimeout: 600 * time.Second}
opt := &opt{
writeTimeout: 600 * time.Second,
dispatchTimeout: 5 * time.Second,
heartbeat: 40 * time.Second,
}

for _, o := range options {
if err := o(opt); err != nil {
Expand Down

0 comments on commit 86a6f5f

Please sign in to comment.