mirror of
https://github.com/Rain-kl/OpenFlare.git
synced 2026-10-01 22:46:38 +08:00
feat(plugins): package database, cache, logger, and storage as infra plugins
This commit is contained in:
@@ -1,3 +1,4 @@
|
||||
// Package driver_asynq_cron provides the Asynq cron schedule driver plugin for Cordis.
|
||||
package driver_asynq_cron
|
||||
|
||||
import (
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
// Package driver_asynq_worker provides the Asynq worker driver plugin for Cordis.
|
||||
package driver_asynq_worker
|
||||
|
||||
import (
|
||||
@@ -120,7 +121,7 @@ func (p *Plugin) Type() core.DriverType {
|
||||
}
|
||||
|
||||
// Start boots the Asynq worker server and starts processing background tasks.
|
||||
func (p *Plugin) Start(ctx context.Context) error {
|
||||
func (p *Plugin) Start(_ context.Context) error {
|
||||
p.mu.Lock()
|
||||
defer p.mu.Unlock()
|
||||
|
||||
@@ -208,10 +209,10 @@ func toAsynqHandler(h any) (asynq.Handler, error) {
|
||||
}
|
||||
|
||||
switch fn := h.(type) {
|
||||
case asynq.Handler:
|
||||
return fn, nil
|
||||
case asynq.HandlerFunc:
|
||||
return fn, nil
|
||||
case asynq.Handler:
|
||||
return fn, nil
|
||||
case func(context.Context, *asynq.Task) error:
|
||||
return asynq.HandlerFunc(fn), nil
|
||||
case func(context.Context, []byte) error:
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
// Package driver_http provides the Gin HTTP web server driver plugin for Cordis.
|
||||
package driver_http
|
||||
|
||||
import (
|
||||
@@ -172,6 +173,8 @@ func (p *Plugin) Start(ctx context.Context) error {
|
||||
}
|
||||
|
||||
// Stop gracefully stops the HTTP server.
|
||||
//
|
||||
//nolint:contextcheck
|
||||
func (p *Plugin) Stop(ctx context.Context) error {
|
||||
p.mu.Lock()
|
||||
defer p.mu.Unlock()
|
||||
|
||||
Reference in New Issue
Block a user