summaryrefslogtreecommitdiff
path: root/tests/plugins/config/plugin3.go
blob: 41b79259b708120d95de6ce3ef029e1b66c72efb (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
package config

import (
	"time"

	"github.com/spiral/errors"
	"github.com/spiral/roadrunner/v2/plugins/config"
)

type Foo3 struct {
	configProvider config.Configurer
}

// Depends on S2 and DB (S3 in the current case)
func (f *Foo3) Init(p config.Configurer) error {
	f.configProvider = p
	return nil
}

func (f *Foo3) Serve() chan error {
	const op = errors.Op("foo_plugin_serve")
	errCh := make(chan error, 1)

	if f.configProvider.GetCommonConfig().GracefulTimeout != time.Second*10 {
		errCh <- errors.E(op, errors.Str("GracefulTimeout should be eq to 10 seconds"))
		return errCh
	}

	return errCh
}

func (f *Foo3) Stop() error {
	return nil
}