From 47acee14062aac70d2e11225420a42a0a9faca68 Mon Sep 17 00:00:00 2001 From: IrineSistiana <49315432+IrineSistiana@users.noreply.github.com> Date: Mon, 4 Oct 2021 11:05:48 +0800 Subject: [PATCH] single_flight: plugin can now be registered from config file --- .../plugin/executable/single_flight/single_flight.go | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/dispatcher/plugin/executable/single_flight/single_flight.go b/dispatcher/plugin/executable/single_flight/single_flight.go index 016d102c2..2bcbebbfb 100644 --- a/dispatcher/plugin/executable/single_flight/single_flight.go +++ b/dispatcher/plugin/executable/single_flight/single_flight.go @@ -30,9 +30,18 @@ const ( ) func init() { + handler.RegInitFunc(PluginType, Init, func() interface{} { return new(Args) }) handler.MustRegPlugin(&singleFlight{BP: handler.NewBP("_single_flight", PluginType)}, true) } +type Args struct{} + +func Init(bp *handler.BP, args interface{}) (p handler.Plugin, err error) { + return &singleFlight{ + BP: bp, + }, err +} + type singleFlight struct { *handler.BP