Add buffer to channels to avoid goroutine leak
This commit is contained in:
parent
090e0c81a1
commit
4e0ac15fe0
2 changed files with 3 additions and 3 deletions
|
|
@ -172,7 +172,7 @@ type getUserResult struct {
|
|||
|
||||
// getUser fetches the user record associated with the GITHUB_TOKEN
|
||||
func getUser(ctx context.Context, apiClient *api.API) <-chan getUserResult {
|
||||
ch := make(chan getUserResult)
|
||||
ch := make(chan getUserResult, 1)
|
||||
go func() {
|
||||
user, err := apiClient.GetUser(ctx)
|
||||
ch <- getUserResult{user, err}
|
||||
|
|
@ -187,7 +187,7 @@ type locationResult struct {
|
|||
|
||||
// getLocation fetches the closest Codespace datacenter region/location to the user.
|
||||
func getLocation(ctx context.Context, apiClient *api.API) <-chan locationResult {
|
||||
ch := make(chan locationResult)
|
||||
ch := make(chan locationResult, 1)
|
||||
go func() {
|
||||
location, err := apiClient.GetCodespaceRegionLocation(ctx)
|
||||
ch <- locationResult{location, err}
|
||||
|
|
|
|||
|
|
@ -123,7 +123,7 @@ type portAttribute struct {
|
|||
}
|
||||
|
||||
func getDevContainer(ctx context.Context, apiClient *api.API, codespace *api.Codespace) <-chan devContainerResult {
|
||||
ch := make(chan devContainerResult)
|
||||
ch := make(chan devContainerResult, 1)
|
||||
go func() {
|
||||
contents, err := apiClient.GetCodespaceRepositoryContents(ctx, codespace, ".devcontainer/devcontainer.json")
|
||||
if err != nil {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue