Skip to content

Commit

Permalink
fix context logic
Browse files Browse the repository at this point in the history
Signed-off-by: binnn6 <734819342@qq.com>
  • Loading branch information
binnn6 committed Nov 16, 2023
1 parent 1c415c2 commit e16793d
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 3 deletions.
30 changes: 28 additions & 2 deletions context/context.go
Original file line number Diff line number Diff line change
Expand Up @@ -752,8 +752,34 @@ func hasPlugin(plugins []string, target string) bool {
func GetRuntimeContext() (RuntimeContext, error) {
if ctx, err := parseContext(); err != nil {
return nil, err
} else {
return ctx, nil
}
return ctx, nil

Check failure on line 756 in context/context.go

View workflow job for this annotation

GitHub Actions / Plugin With Apache SkyWalking - Sync Request

undefined: ctx

Check failure on line 756 in context/context.go

View workflow job for this annotation

GitHub Actions / build

undefined: ctx
}

func CloneRuntimeContext(ctx RuntimeContext) RuntimeContext {
return &FunctionContext{

Name: ctx.GetName(),
Version: ctx.GetContext().Version,
Inputs: ctx.GetInputs(),
Outputs: ctx.GetOutputs(),

Runtime: ctx.GetRuntime(),
Port: ctx.GetPort(),
State: ctx.GetContext().State,

PrePlugins: ctx.GetPrePlugins(),
PostPlugins: ctx.GetPostPlugins(),
PluginsTracing: ctx.GetContext().PluginsTracing,
HttpPattern: ctx.GetHttpPattern(),

Event: &EventRequest{},
SyncRequest: &SyncRequest{},
mode: ctx.GetMode(),
podName: ctx.GetPodName(),
podNamespace: ctx.GetPodNamespace(),
options: ctx.GetContext().options,
daprClient: ctx.GetContext().daprClient,
}
}

Expand Down
2 changes: 1 addition & 1 deletion runtime/runtime.go
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ type RuntimeManager struct {
}

func NewRuntimeManager(funcContext ofctx.RuntimeContext, prePlugin []plugin.Plugin, postPlugin []plugin.Plugin) *RuntimeManager {
ctx := funcContext
ctx := ofctx.CloneRuntimeContext(funcContext)
rm := &RuntimeManager{
FuncContext: ctx,
prePlugins: prePlugin,
Expand Down

0 comments on commit e16793d

Please sign in to comment.