Skip to content

SetUp() should provide a way to end the goroutine #62

@rfay

Description

@rfay

Expected Behavior

There shouldn't be running goroutines at exit.

Current Behavior

func (p *amplitudePlugin) Setup(config types.Config) {} does

go p.start(p.messageChannel)

The goroutine is still running on exit.

Possible Solution

  • Provide a way to terminate the goroutine
  • Return p.messageChannel so that it could be sent a message to terminate.

Steps to Reproduce

In any go program using analytics-go add

		defer func() {
			p := pprof.Lookup("goroutine")

			p.WriteTo(os.Stdout, 2)

			numGoroutines := runtime.NumGoroutine()
			printf("goroutines at exit of main()=%d", numGoroutines)
		}()

You'll see the running goroutine started by start()

Environment

  • SDK Version: v1.0.1
  • Go Version: go1.22.1
  • OS Info: macOS 14

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions