Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

infinitbyte/gopa: plugins/dispatch/dispatch.go; 44 LoC #18443

Open
githubvet opened this issue Jan 9, 2021 · 0 comments
Open

infinitbyte/gopa: plugins/dispatch/dispatch.go; 44 LoC #18443

githubvet opened this issue Jan 9, 2021 · 0 comments
Labels
fresh no one has ever voted on this issue small between 10-50 lines of code

Comments

@githubvet
Copy link
Collaborator

Found a possible issue in infinitbyte/gopa at plugins/dispatch/dispatch.go

Below is the message reported by the analyzer for this snippet of code. Beware that the analyzer only reports the first issue it finds, so please do not limit your consideration to the contents of the below message.

Click here to see the code in its original context.

Click here to show the 44 line(s) of Go which triggered the analyzer.
	for _, v := range tasks {
		log.Trace("get task from db, ", v.ID)

		if v.Status == model.TaskPendingFetch {
			log.Tracef("task %v alrady in fetch, ingore", v.ID)
			continue
		}

		context := pipeline.Context{}
		context.Set(model.CONTEXT_TASK_ID, v.ID)

		//update offset
		if v.Created.Unix() > offset {
			offset = v.Created.Unix()
		}

		runner := "fetch"

		if v.HostConfig == nil && cfg.GetHostConfigByUrl {
			//assign pipeline config
			config, _ := model.GetHostConfigByHostAndUrl(runner, v.Host, v.Url)
			if config != nil {
				v.HostConfig = config
				context.Set(model.CONTEXT_TASK_Cookies, v.HostConfig.Cookies)
				context.Set(model.CONTEXT_TASK_PipelineConfigID, v.HostConfig.PipelineID)
				log.Trace("get host config: ", util.ToJson(config, true))
			}
		}

		if v.PipelineConfigID != "" {
			context.Set(model.CONTEXT_TASK_PipelineConfigID, v.PipelineConfigID)
		}

		//Update task status
		v.Status = model.TaskPendingFetch
		model.UpdateTask(&v)
		err := queue.Push(config.FetchChannel, util.ToJSONBytes(context))
		log.Trace("push task to fetch queue, ", v.ID)

		if err != nil {
			log.Error(err)
			continue
		}
	}
Click here to show extra information the analyzer produced.
No path was found through the callgraph that could lead to a function which writes a pointer argument.

No path was found through the callgraph that could lead to a function which passes a pointer to third-party code.

root signature {UpdateTask 1} was not found in the callgraph; reference was passed directly to third-party code

Leave a reaction on this issue to contribute to the project by classifying this instance as a Bug 👎, Mitigated 👍, or Desirable Behavior 🚀
See the descriptions of the classifications here for more information.

commit ID: 9f9c894139be5810924f22c8b0273dcd0380f45a

@githubvet githubvet added fresh no one has ever voted on this issue small between 10-50 lines of code labels Jan 9, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
fresh no one has ever voted on this issue small between 10-50 lines of code
Projects
None yet
Development

No branches or pull requests

1 participant