diff --git a/models/domainlayer/crossdomain/account.go b/models/domainlayer/crossdomain/account.go new file mode 100644 index 00000000000..1eb25ec2a6d --- /dev/null +++ b/models/domainlayer/crossdomain/account.go @@ -0,0 +1,39 @@ +/* +Licensed to the Apache Software Foundation (ASF) under one or more +contributor license agreements. See the NOTICE file distributed with +this work for additional information regarding copyright ownership. +The ASF licenses this file to You under the Apache License, Version 2.0 +(the "License"); you may not use this file except in compliance with +the License. You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +package crossdomain + +import ( + "time" + + "github.com/apache/incubator-devlake/models/domainlayer" +) + +type Account struct { + domainlayer.DomainEntity + Email string `gorm:"type:varchar(255)"` + FullName string `gorm:"type:varchar(255)"` + UserName string `gorm:"type:varchar(255)"` + AvatarUrl string `gorm:"type:varchar(255)"` + Organization string `gorm:"type:varchar(255)"` + CreatedDate *time.Time + Status int +} + +func (Account) TableName() string { + return "accounts" +} diff --git a/models/domainlayer/crossdomain/team.go b/models/domainlayer/crossdomain/team.go new file mode 100644 index 00000000000..caf02a65cbd --- /dev/null +++ b/models/domainlayer/crossdomain/team.go @@ -0,0 +1,32 @@ +/* +Licensed to the Apache Software Foundation (ASF) under one or more +contributor license agreements. See the NOTICE file distributed with +this work for additional information regarding copyright ownership. +The ASF licenses this file to You under the Apache License, Version 2.0 +(the "License"); you may not use this file except in compliance with +the License. You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +package crossdomain + +import "github.com/apache/incubator-devlake/models/domainlayer" + +type Team struct { + domainlayer.DomainEntity + Name string `gorm:"type:varchar(255)"` + Alias string `gorm:"type:varchar(255)"` + ParentId string `gorm:"type:varchar(255)"` + SortingIndex int +} + +func (Team) TableName() string { + return "teams" +} diff --git a/models/domainlayer/crossdomain/team_user.go b/models/domainlayer/crossdomain/team_user.go new file mode 100644 index 00000000000..41417a667b0 --- /dev/null +++ b/models/domainlayer/crossdomain/team_user.go @@ -0,0 +1,27 @@ +/* +Licensed to the Apache Software Foundation (ASF) under one or more +contributor license agreements. See the NOTICE file distributed with +this work for additional information regarding copyright ownership. +The ASF licenses this file to You under the Apache License, Version 2.0 +(the "License"); you may not use this file except in compliance with +the License. You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +package crossdomain + +type TeamUser struct { + TeamId string `gorm:"primaryKey;type:varchar(255)"` + UserId string `gorm:"primaryKey;type:varchar(255)"` +} + +func (TeamUser) TableName() string { + return "team_users" +} diff --git a/models/domainlayer/user/user.go b/models/domainlayer/crossdomain/user.go similarity index 82% rename from models/domainlayer/user/user.go rename to models/domainlayer/crossdomain/user.go index 9eccd3407f0..c9b888d65ed 100644 --- a/models/domainlayer/user/user.go +++ b/models/domainlayer/crossdomain/user.go @@ -15,7 +15,7 @@ See the License for the specific language governing permissions and limitations under the License. */ -package user +package crossdomain import ( "github.com/apache/incubator-devlake/models/domainlayer" @@ -23,10 +23,8 @@ import ( type User struct { domainlayer.DomainEntity - Name string `gorm:"type:varchar(255)"` - Email string `gorm:"type:varchar(255)"` - AvatarUrl string `gorm:"type:varchar(255)"` - Timezone string `gorm:"type:varchar(255)"` + Email string `gorm:"type:varchar(255)"` + Name string `gorm:"type:varchar(255)"` } func (User) TableName() string { diff --git a/models/domainlayer/crossdomain/user_account.go b/models/domainlayer/crossdomain/user_account.go new file mode 100644 index 00000000000..405d6f58e4b --- /dev/null +++ b/models/domainlayer/crossdomain/user_account.go @@ -0,0 +1,27 @@ +/* +Licensed to the Apache Software Foundation (ASF) under one or more +contributor license agreements. See the NOTICE file distributed with +this work for additional information regarding copyright ownership. +The ASF licenses this file to You under the Apache License, Version 2.0 +(the "License"); you may not use this file except in compliance with +the License. You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +package crossdomain + +type UserAccount struct { + UserId string `gorm:"primaryKey;type:varchar(255)"` + AccountId string `gorm:"primaryKey;type:varchar(255)"` +} + +func (UserAccount) TableName() string { + return "user_accounts" +} diff --git a/models/migrationscripts/register.go b/models/migrationscripts/register.go index 851ee575c64..ddd1b4d6268 100644 --- a/models/migrationscripts/register.go +++ b/models/migrationscripts/register.go @@ -29,6 +29,8 @@ func All() []migration.Script { new(updateSchemas20220602), new(updateSchemas20220612), new(updateSchemas20220613), new(updateSchemas20220614), new(updateSchemas2022061402), new(updateSchemas20220616), new(blueprintNormalMode), - new(UpdateSchemas20220630), new(UpdateSchemas20220704), + new(UpdateSchemas20220630), + new(UpdateSchemas20220704), + new(UpdateSchemas20220705), } } diff --git a/models/migrationscripts/updateSchemas20220705.go b/models/migrationscripts/updateSchemas20220705.go new file mode 100644 index 00000000000..0a34f76e0af --- /dev/null +++ b/models/migrationscripts/updateSchemas20220705.go @@ -0,0 +1,104 @@ +/* +Licensed to the Apache Software Foundation (ASF) under one or more +contributor license agreements. See the NOTICE file distributed with +this work for additional information regarding copyright ownership. +The ASF licenses this file to You under the Apache License, Version 2.0 +(the "License"); you may not use this file except in compliance with +the License. You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +package migrationscripts + +import ( + "context" + "time" + + "github.com/apache/incubator-devlake/models/migrationscripts/archived" + "gorm.io/gorm" +) + +type User struct { + archived.DomainEntity + Email string `gorm:"type:varchar(255)"` + Name string `gorm:"type:varchar(255)"` +} + +type Account struct { + archived.DomainEntity + Email string `gorm:"type:varchar(255)"` + FullName string `gorm:"type:varchar(255)"` + UserName string `gorm:"type:varchar(255)"` + AvatarUrl string `gorm:"type:varchar(255)"` + Organization string `gorm:"type:varchar(255)"` + CreatedDate *time.Time + Status int +} + +type UserAccount struct { + UserId string `gorm:"primaryKey;type:varchar(255)"` + AccountId string `gorm:"primaryKey;type:varchar(255)"` +} + +type Team struct { + archived.DomainEntity + Name string `gorm:"type:varchar(255)"` + Alias string `gorm:"type:varchar(255)"` + ParentId string `gorm:"type:varchar(255)"` + SortingIndex int +} + +type TeamUser struct { + TeamId string `gorm:"primaryKey;type:varchar(255)"` + UserId string `gorm:"primaryKey;type:varchar(255)"` +} + +type UpdateSchemas20220705 struct { +} + +func (u *UpdateSchemas20220705) Up(ctx context.Context, db *gorm.DB) error { + err := db.Migrator().RenameTable("users", "accounts") + if err != nil { + return err + } + err = db.Migrator().DropColumn(&Account{}, "timezone") + if err != nil { + return err + } + err = db.Migrator().AutoMigrate(&User{}) + if err != nil { + return err + } + err = db.Migrator().AutoMigrate(&Account{}) + if err != nil { + return err + } + err = db.Migrator().AutoMigrate(&UserAccount{}) + if err != nil { + return err + } + err = db.Migrator().AutoMigrate(&Team{}) + if err != nil { + return err + } + err = db.Migrator().AutoMigrate(&TeamUser{}) + if err != nil { + return err + } + return nil +} + +func (*UpdateSchemas20220705) Version() uint64 { + return 20220705141638 +} + +func (*UpdateSchemas20220705) Name() string { + return "rename users to accounts, create users, user_accounts, teams, team_users" +} diff --git a/plugins/gitee/tasks/account_convertor.go b/plugins/gitee/tasks/account_convertor.go index 44edc410a31..b2e5d581cde 100644 --- a/plugins/gitee/tasks/account_convertor.go +++ b/plugins/gitee/tasks/account_convertor.go @@ -18,13 +18,13 @@ limitations under the License. package tasks import ( + "github.com/apache/incubator-devlake/models/domainlayer/crossdomain" "reflect" "github.com/apache/incubator-devlake/plugins/core/dal" "github.com/apache/incubator-devlake/models/domainlayer" "github.com/apache/incubator-devlake/models/domainlayer/didgen" - "github.com/apache/incubator-devlake/models/domainlayer/user" "github.com/apache/incubator-devlake/plugins/core" "github.com/apache/incubator-devlake/plugins/gitee/models" "github.com/apache/incubator-devlake/plugins/helper" @@ -47,7 +47,7 @@ func ConvertAccounts(taskCtx core.SubTaskContext) error { } defer cursor.Close() - userIdGen := didgen.NewDomainIdGenerator(&models.GiteeAccount{}) + accountIdGen := didgen.NewDomainIdGenerator(&models.GiteeAccount{}) converter, err := helper.NewDataConverter(helper.DataConverterArgs{ InputRowType: reflect.TypeOf(models.GiteeAccount{}), @@ -55,9 +55,9 @@ func ConvertAccounts(taskCtx core.SubTaskContext) error { RawDataSubTaskArgs: *rawDataSubTaskArgs, Convert: func(inputRow interface{}) ([]interface{}, error) { GiteeAccount := inputRow.(*models.GiteeAccount) - domainUser := &user.User{ - DomainEntity: domainlayer.DomainEntity{Id: userIdGen.Generate(data.Options.ConnectionId, GiteeAccount.Id)}, - Name: GiteeAccount.Login, + domainUser := &crossdomain.Account{ + DomainEntity: domainlayer.DomainEntity{Id: accountIdGen.Generate(data.Options.ConnectionId, GiteeAccount.Id)}, + UserName: GiteeAccount.Login, AvatarUrl: GiteeAccount.AvatarUrl, } return []interface{}{ diff --git a/plugins/gitee/tasks/commit_convertor.go b/plugins/gitee/tasks/commit_convertor.go index 06cd11c4518..6709ec410b7 100644 --- a/plugins/gitee/tasks/commit_convertor.go +++ b/plugins/gitee/tasks/commit_convertor.go @@ -56,7 +56,7 @@ func ConvertCommits(taskCtx core.SubTaskContext) error { } defer cursor.Close() - userDidGen := didgen.NewDomainIdGenerator(&models.GiteeAccount{}) + accountIdGen := didgen.NewDomainIdGenerator(&models.GiteeAccount{}) repoDidGen := didgen.NewDomainIdGenerator(&models.GiteeRepo{}) domainRepoId := repoDidGen.Generate(data.Options.ConnectionId, repoId) @@ -74,14 +74,14 @@ func ConvertCommits(taskCtx core.SubTaskContext) error { commit.Message = giteeCommit.Message commit.Additions = giteeCommit.Additions commit.Deletions = giteeCommit.Deletions - commit.AuthorId = userDidGen.Generate(data.Options.ConnectionId, giteeCommit.AuthorId) + commit.AuthorId = accountIdGen.Generate(data.Options.ConnectionId, giteeCommit.AuthorId) commit.AuthorName = giteeCommit.AuthorName commit.AuthorEmail = giteeCommit.AuthorEmail commit.AuthoredDate = giteeCommit.AuthoredDate commit.CommitterName = giteeCommit.CommitterName commit.CommitterEmail = giteeCommit.CommitterEmail commit.CommittedDate = giteeCommit.CommittedDate - commit.CommitterId = userDidGen.Generate(data.Options.ConnectionId, giteeCommit.CommitterId) + commit.CommitterId = accountIdGen.Generate(data.Options.ConnectionId, giteeCommit.CommitterId) // convert repo / commits relationship repoCommit := &code.RepoCommit{ diff --git a/plugins/gitee/tasks/issue_comment_convertor.go b/plugins/gitee/tasks/issue_comment_convertor.go index d48cc24a3fc..e20ab3c77a8 100644 --- a/plugins/gitee/tasks/issue_comment_convertor.go +++ b/plugins/gitee/tasks/issue_comment_convertor.go @@ -54,7 +54,7 @@ func ConvertIssueComments(taskCtx core.SubTaskContext) error { defer cursor.Close() issueIdGen := didgen.NewDomainIdGenerator(&models.GiteeIssue{}) - userIdGen := didgen.NewDomainIdGenerator(&models.GiteeAccount{}) + accountIdGen := didgen.NewDomainIdGenerator(&models.GiteeAccount{}) converter, err := helper.NewDataConverter(helper.DataConverterArgs{ InputRowType: reflect.TypeOf(models.GiteeIssueComment{}), @@ -68,7 +68,7 @@ func ConvertIssueComments(taskCtx core.SubTaskContext) error { }, IssueId: issueIdGen.Generate(data.Options.ConnectionId, giteeIssueComment.IssueId), Body: giteeIssueComment.Body, - UserId: userIdGen.Generate(data.Options.ConnectionId, giteeIssueComment.AuthorUserId), + UserId: accountIdGen.Generate(data.Options.ConnectionId, giteeIssueComment.AuthorUserId), CreatedDate: giteeIssueComment.GiteeCreatedAt, } return []interface{}{ diff --git a/plugins/gitee/tasks/issue_convertor.go b/plugins/gitee/tasks/issue_convertor.go index 92d5806baca..b30dfa64df9 100644 --- a/plugins/gitee/tasks/issue_convertor.go +++ b/plugins/gitee/tasks/issue_convertor.go @@ -55,7 +55,7 @@ func ConvertIssues(taskCtx core.SubTaskContext) error { defer cursor.Close() issueIdGen := didgen.NewDomainIdGenerator(&giteeModels.GiteeIssue{}) - userIdGen := didgen.NewDomainIdGenerator(&giteeModels.GiteeAccount{}) + accountIdGen := didgen.NewDomainIdGenerator(&giteeModels.GiteeAccount{}) boardIdGen := didgen.NewDomainIdGenerator(&giteeModels.GiteeRepo{}) converter, err := helper.NewDataConverter(helper.DataConverterArgs{ @@ -71,9 +71,9 @@ func ConvertIssues(taskCtx core.SubTaskContext) error { Description: issue.Body, Priority: issue.Priority, Type: issue.Type, - AssigneeId: userIdGen.Generate(data.Options.ConnectionId, issue.AssigneeId), + AssigneeId: accountIdGen.Generate(data.Options.ConnectionId, issue.AssigneeId), AssigneeName: issue.AssigneeName, - CreatorId: userIdGen.Generate(data.Options.ConnectionId, issue.AuthorId), + CreatorId: accountIdGen.Generate(data.Options.ConnectionId, issue.AuthorId), CreatorName: issue.AuthorName, LeadTimeMinutes: issue.LeadTimeMinutes, Url: issue.Url, diff --git a/plugins/gitee/tasks/pr_comment_convertor.go b/plugins/gitee/tasks/pr_comment_convertor.go index d089ce01089..4d76e034f86 100644 --- a/plugins/gitee/tasks/pr_comment_convertor.go +++ b/plugins/gitee/tasks/pr_comment_convertor.go @@ -54,7 +54,7 @@ func ConvertPullRequestComments(taskCtx core.SubTaskContext) error { defer cursor.Close() prIdGen := didgen.NewDomainIdGenerator(&models.GiteePullRequest{}) - userIdGen := didgen.NewDomainIdGenerator(&models.GiteeAccount{}) + accountIdGen := didgen.NewDomainIdGenerator(&models.GiteeAccount{}) converter, err := helper.NewDataConverter(helper.DataConverterArgs{ InputRowType: reflect.TypeOf(models.GiteePullRequestComment{}), @@ -68,7 +68,7 @@ func ConvertPullRequestComments(taskCtx core.SubTaskContext) error { }, PullRequestId: prIdGen.Generate(data.Options.ConnectionId, giteePullRequestComment.PullRequestId), Body: giteePullRequestComment.Body, - UserId: userIdGen.Generate(data.Options.ConnectionId, giteePullRequestComment.AuthorUserId), + UserId: accountIdGen.Generate(data.Options.ConnectionId, giteePullRequestComment.AuthorUserId), CreatedDate: giteePullRequestComment.GiteeCreatedAt, CommitSha: "", Position: 0, diff --git a/plugins/gitee/tasks/pr_convertor.go b/plugins/gitee/tasks/pr_convertor.go index 20fe2cbd3e5..711ce6b2a95 100644 --- a/plugins/gitee/tasks/pr_convertor.go +++ b/plugins/gitee/tasks/pr_convertor.go @@ -53,7 +53,7 @@ func ConvertPullRequests(taskCtx core.SubTaskContext) error { prIdGen := didgen.NewDomainIdGenerator(&models.GiteePullRequest{}) repoIdGen := didgen.NewDomainIdGenerator(&models.GiteeRepo{}) - userIdGen := didgen.NewDomainIdGenerator(&models.GiteeAccount{}) + accountIdGen := didgen.NewDomainIdGenerator(&models.GiteeAccount{}) converter, err := helper.NewDataConverter(helper.DataConverterArgs{ InputRowType: reflect.TypeOf(models.GiteePullRequest{}), @@ -69,7 +69,7 @@ func ConvertPullRequests(taskCtx core.SubTaskContext) error { Status: pr.State, Title: pr.Title, Url: pr.Url, - AuthorId: userIdGen.Generate(data.Options.ConnectionId, pr.AuthorId), + AuthorId: accountIdGen.Generate(data.Options.ConnectionId, pr.AuthorId), AuthorName: pr.AuthorName, Description: pr.Body, CreatedDate: pr.GiteeCreatedAt, diff --git a/plugins/github/e2e/comment_test.go b/plugins/github/e2e/comment_test.go index 17487a2ee7c..555a88902c8 100644 --- a/plugins/github/e2e/comment_test.go +++ b/plugins/github/e2e/comment_test.go @@ -66,7 +66,7 @@ func TestCommentDataFlow(t *testing.T) { // verify extraction dataflowTester.FlushTabler(&models.GithubIssueComment{}) dataflowTester.FlushTabler(&models.GithubPullRequestComment{}) - dataflowTester.FlushTabler(&models.GithubUser{}) + dataflowTester.FlushTabler(&models.GithubAccount{}) dataflowTester.Subtask(tasks.ExtractApiCommentsMeta, taskData) dataflowTester.VerifyTable( models.GithubIssueComment{}, @@ -105,7 +105,7 @@ func TestCommentDataFlow(t *testing.T) { }, ) dataflowTester.VerifyTable( - models.GithubUser{}, + models.GithubAccount{}, "./snapshot_tables/_tool_github_accounts_in_comment.csv", []string{ "connection_id", diff --git a/plugins/github/e2e/event_test.go b/plugins/github/e2e/event_test.go index c080ebb1fb6..fc1aa67bef4 100644 --- a/plugins/github/e2e/event_test.go +++ b/plugins/github/e2e/event_test.go @@ -48,7 +48,7 @@ func TestEventDataFlow(t *testing.T) { // verify extraction dataflowTester.FlushTabler(&models.GithubIssueEvent{}) - dataflowTester.FlushTabler(&models.GithubUser{}) + dataflowTester.FlushTabler(&models.GithubAccount{}) dataflowTester.Subtask(tasks.ExtractApiEventsMeta, taskData) dataflowTester.VerifyTable( models.GithubIssueEvent{}, @@ -67,7 +67,7 @@ func TestEventDataFlow(t *testing.T) { }, ) dataflowTester.VerifyTable( - models.GithubUser{}, + models.GithubAccount{}, "./snapshot_tables/_tool_github_accounts_in_event.csv", []string{ "connection_id", diff --git a/plugins/github/e2e/issue_test.go b/plugins/github/e2e/issue_test.go index 3cbec5cb108..f62e3e4e8d1 100644 --- a/plugins/github/e2e/issue_test.go +++ b/plugins/github/e2e/issue_test.go @@ -61,7 +61,7 @@ func TestIssueDataFlow(t *testing.T) { // verify issue extraction dataflowTester.FlushTabler(&models.GithubIssue{}) dataflowTester.FlushTabler(&models.GithubIssueLabel{}) - dataflowTester.FlushTabler(&models.GithubUser{}) + dataflowTester.FlushTabler(&models.GithubAccount{}) dataflowTester.Subtask(tasks.ExtractApiIssuesMeta, taskData) dataflowTester.VerifyTable( models.GithubIssue{}, @@ -109,7 +109,7 @@ func TestIssueDataFlow(t *testing.T) { }, ) dataflowTester.VerifyTable( - models.GithubUser{}, + models.GithubAccount{}, "./snapshot_tables/_tool_github_accounts_in_issue.csv", []string{ "connection_id", diff --git a/plugins/github/e2e/pr_reviewer_test.go b/plugins/github/e2e/pr_reviewer_test.go index 55a5bef0feb..db3e165c2e3 100644 --- a/plugins/github/e2e/pr_reviewer_test.go +++ b/plugins/github/e2e/pr_reviewer_test.go @@ -49,7 +49,7 @@ func TestPrReviewerDataFlow(t *testing.T) { // verify extraction dataflowTester.FlushTabler(&models.GithubReviewer{}) - dataflowTester.FlushTabler(&models.GithubUser{}) + dataflowTester.FlushTabler(&models.GithubAccount{}) dataflowTester.Subtask(tasks.ExtractApiPullRequestReviewersMeta, taskData) dataflowTester.VerifyTable( models.GithubReviewer{}, @@ -66,7 +66,7 @@ func TestPrReviewerDataFlow(t *testing.T) { }, ) dataflowTester.VerifyTable( - models.GithubUser{}, + models.GithubAccount{}, "./snapshot_tables/_tool_github_accounts_in_review.csv", []string{ "connection_id", diff --git a/plugins/github/e2e/pr_test.go b/plugins/github/e2e/pr_test.go index 94fdfadea3a..1b856e6e972 100644 --- a/plugins/github/e2e/pr_test.go +++ b/plugins/github/e2e/pr_test.go @@ -55,7 +55,7 @@ func TestPrDataFlow(t *testing.T) { // verify pr extraction dataflowTester.FlushTabler(&models.GithubPullRequest{}) dataflowTester.FlushTabler(&models.GithubPullRequestLabel{}) - dataflowTester.FlushTabler(&models.GithubUser{}) + dataflowTester.FlushTabler(&models.GithubAccount{}) dataflowTester.Subtask(tasks.ExtractApiPullRequestsMeta, taskData) dataflowTester.VerifyTable( models.GithubPullRequest{}, @@ -102,7 +102,7 @@ func TestPrDataFlow(t *testing.T) { ) dataflowTester.VerifyTable( - models.GithubUser{}, + models.GithubAccount{}, "./snapshot_tables/_tool_github_accounts_in_pr.csv", []string{ "connection_id", diff --git a/plugins/github/e2e/repo_test.go b/plugins/github/e2e/repo_test.go index b21600befea..f30e3040294 100644 --- a/plugins/github/e2e/repo_test.go +++ b/plugins/github/e2e/repo_test.go @@ -54,7 +54,7 @@ func TestRepoDataFlow(t *testing.T) { // verify extraction dataflowTester.FlushTabler(&models.GithubRepo{}) - dataflowTester.FlushTabler(&models.GithubUser{}) + dataflowTester.FlushTabler(&models.GithubAccount{}) dataflowTester.Subtask(tasks.ExtractApiRepoMeta, taskData) dataflowTester.VerifyTable( models.GithubRepo{}, @@ -77,7 +77,7 @@ func TestRepoDataFlow(t *testing.T) { }, ) dataflowTester.VerifyTable( - models.GithubUser{}, + models.GithubAccount{}, "./snapshot_tables/_tool_github_accounts_in_repo.csv", []string{ "connection_id", diff --git a/plugins/github/e2e/snapshot_tables/issue_comments.csv b/plugins/github/e2e/snapshot_tables/issue_comments.csv index 80530d37131..703c1f85f69 100644 --- a/plugins/github/e2e/snapshot_tables/issue_comments.csv +++ b/plugins/github/e2e/snapshot_tables/issue_comments.csv @@ -1,49 +1,49 @@ id,issue_id,body,user_id,created_date -github:GithubIssue:1:409800144,github:GithubIssue:1:346842831,"""这里freeSignal和idleWorkers的数量是绝对匹配的,也就是说,只要freeSignal有值那么idleWorkers里肯定有可用worker可以取出来,putWorker就是把可用worker放回idleWorkers,每次都会塞一个值进freeSignal,还有每次从idleWorkers里取一个worker都要取出freeSignal对应的一个值,不存在有可用worker却被freeSignal阻塞""",github:GithubUser:1:7496278,2018-08-02T04:13:09.000+00:00 -github:GithubIssue:1:410141732,github:GithubIssue:1:347255859,"""切片如下\r\n\r\n这里等待锁\r\n9913 @ 0x42c73a 0x42c7ee 0x43cf64 0x43cc7d 0x46dfe8 0x7b28e0 0x7b2be5 0x4591f1\r\n#\t0x43cc7c\tsync.runtime_SemacquireMutex+0x3c\t\t\t\tE:/go/src/runtime/sema.go:71\r\n#\t0x46dfe7\tsync.(*Mutex).Lock+0x107\t\t\t\t\tE:/go/src/sync/mutex.go:134\r\n#\t0x7b28df\tmp/vendor/github.com/panjf2000/ants.(*Pool).putWorker+0x6f\tF:/gowork/src/mp/vendor/github.com/panjf2000/ants/pool.go:229\r\n#\t0x7b2be4\tmp/vendor/github.com/panjf2000/ants.(*Worker).run.func1+0x54\tF:/gowork/src/mp/vendor/github.com/panjf2000/ants/worker.go:53\r\n\r\n\r\n//这里占用了锁无法释放\r\n1 @ 0x42c73a 0x42c7ee 0x404212 0x403ecb 0x7b27df 0x7b23e2 0x7f694a 0x7f68e1 0x4591f1\r\n#\t0x7b27de\tmp/vendor/github.com/panjf2000/ants.(*Pool).getWorker+0x22e\tF:/gowork/src/mp/vendor/github.com/panjf2000/ants/pool.go:199\r\n#\t0x7b23e1\tmp/vendor/github.com/panjf2000/ants.(*Pool).Submit+0x61\t\tF:/gowork/src/mp/vendor/github.com/panjf2000/ants/pool.go:125\r\n\r\n\r\n""",github:GithubUser:1:13118848,2018-08-03T04:33:23.000+00:00 -github:GithubIssue:1:410143221,github:GithubIssue:1:347255859,"""加了锁之后有下标溢出了。。。\r\npanic: runtime error: index out of range\r\n\r\ngoroutine 7 [running]:\r\nmp/vendor/github.com/panjf2000/ants.(*Pool).getWorker(0xc4200b6460, 0xc4202a6e01)\r\n\tF:/gowork/src/mp/vendor/github.com/panjf2000/ants/pool.go:213 +0x2ce\r\nmp/vendor/github.com/panjf2000/ants.(*Pool).Submit(0xc4200b6460, 0xc4223d47d0, 0x0, 0x0)\r\n\tF:/gowork/src/mp/vendor/github.com/panjf2000/ants/pool.go:125 +0x62\r\n""",github:GithubUser:1:13118848,2018-08-03T04:46:13.000+00:00 -github:GithubIssue:1:410147487,github:GithubIssue:1:347255859,"""@lovelly 我查了源码,怎么行数和你说的有点对不上,你的代码更新到最新了吗?""",github:GithubUser:1:7496278,2018-08-03T05:21:03.000+00:00 -github:GithubIssue:1:410170764,github:GithubIssue:1:347255859,"""😄 😄 😄 是最新的代码,我有添加一些print 所以行数不一样,这确实是一个bug 9913个协程阻塞在了 putWorker 很久很久。,。。。""",github:GithubUser:1:13118848,2018-08-03T07:33:21.000+00:00 -github:GithubIssue:1:410173358,github:GithubIssue:1:347255859,"""![image](https://user-images.githubusercontent.com/13118848/43630582-44f48000-9733-11e8-936d-9cb0d4145204.png)\r\n 我idleWorkers 为空的, 但是我有n个协程阻塞在了 204行的\t<-p.freeSignal, 这时候来了一个worker被放入idleWorkers, 很巧的是一个协程在putWorker结束锁后,在190行的p.lock.Lock()拿到了锁,这时候 n := len(idleWorkers) - 1 结果是0 这个协程很高兴的进入了接下来的else分支, 然而不幸发生了,p.freeSignal的信号确被早已等在 204行的若干个协程中的一个拿走了, 那么 可怜的协程拿到了锁, 确无法等到 p.freeSignal p.freeSignal要拿到锁才能产生信号, 然后就。,。。""",github:GithubUser:1:13118848,2018-08-03T07:44:32.000+00:00 -github:GithubIssue:1:410204870,github:GithubIssue:1:347255859,"""@lovelly 检查了一下,的确可能会有这个问题,这两天我会修复;\r\n另外,我测试的时候试过1000w的量都没发现过这个问题,可能是我每个任务的执行时间太短了,所以我想问下你的任务量有多大以及每个任务的耗时大概是多少?""",github:GithubUser:1:7496278,2018-08-03T09:51:15.000+00:00 -github:GithubIssue:1:410205295,github:GithubIssue:1:347255859,"""😄 😄 😄 我任务耗时从0秒到60秒之间。。。""",github:GithubUser:1:13118848,2018-08-03T09:53:00.000+00:00 -github:GithubIssue:1:410267195,github:GithubIssue:1:347255859,"""@lovelly 应该已经修复了,可以再试试""",github:GithubUser:1:7496278,2018-08-03T14:15:45.000+00:00 -github:GithubIssue:1:410290418,github:GithubIssue:1:346842831,"""具体问题可以看 #6 """,github:GithubUser:1:7496278,2018-08-03T15:32:00.000+00:00 -github:GithubIssue:1:411342200,github:GithubIssue:1:348630179,"""@huiwq1990 谢谢指出,今天会修复这个问题。""",github:GithubUser:1:7496278,2018-08-08T09:17:30.000+00:00 -github:GithubIssue:1:411369513,github:GithubIssue:1:348630179,"""@huiwq1990 应该解决了,可以再试试""",github:GithubUser:1:7496278,2018-08-08T11:06:55.000+00:00 -github:GithubIssue:1:411965696,github:GithubIssue:1:348630179,"""嗯,解决了""",github:GithubUser:1:4555057,2018-08-10T03:35:53.000+00:00 -github:GithubIssue:1:411969260,github:GithubIssue:1:348630179,"""@huiwq1990 好的,那我关掉这个issue了。""",github:GithubUser:1:7496278,2018-08-10T04:06:04.000+00:00 -github:GithubIssue:1:418287926,github:GithubIssue:1:356703393,"""会导致很多任务长时间在阻塞,至于cpu飙升应该不会""",github:GithubUser:1:7496278,2018-09-04T08:40:06.000+00:00 -github:GithubIssue:1:418290090,github:GithubIssue:1:356703393,"""所以应该在goroutine中调用submit 否则会阻塞主任务""",github:GithubUser:1:11763614,2018-09-04T08:47:39.000+00:00 -github:GithubIssue:1:418293975,github:GithubIssue:1:356703393,"""不是的,如果每一个submit都用一个goroutine那不就违背初衷了吗,这样的话你有多少个任务还是要启动多少个原生goroutine。""",github:GithubUser:1:7496278,2018-09-04T09:00:55.000+00:00 -github:GithubIssue:1:418297020,github:GithubIssue:1:356703393,"""// Submit submits a task to this pool.\r\nfunc (p *Pool) Submit(task f) error {\r\n\tif len(p.release) > 0 {\r\n\t\treturn ErrPoolClosed\r\n\t}\r\n\tp.getWorker().task <- task\r\n\treturn nil\r\n}\r\n我是觉得p.getWorker() 阻塞不太好 ,这样主任务和pool没有彻底隔离""",github:GithubUser:1:11763614,2018-09-04T09:11:37.000+00:00 -github:GithubIssue:1:425014962,github:GithubIssue:1:364361014,"""我晚上回去就打一下新的tag,完了我再给你回一个邮件\r\n\r\nedcismybrother 于2018年9月27日周四 下午4:32写道:\r\n\r\n> 鄙人现在在弄dep依赖管理,有用到你写的ants项目,可是你好像忘记打最新的tag了。最新的tag\r\n> 3.6是指向ed55924这个提交,git上的最新代码是af376f1b这次提交,两次提交都隔了快5个月了,看到的话,麻烦打一个最新的tag吧。(手动可怜)\r\n>\r\n> —\r\n> You are receiving this because you are subscribed to this thread.\r\n> Reply to this email directly, view it on GitHub\r\n> , or mute the thread\r\n> \r\n> .\r\n>\r\n""",github:GithubUser:1:7496278,2018-09-27T09:00:40.000+00:00 -github:GithubIssue:1:425018770,github:GithubIssue:1:356703393,"""我觉得这个会导致cpu上升。调用Submit时,如果没有多余的worker,会一直进入这个死循环\r\n```\t\t\r\nfor {\r\n\t\t\tp.lock.Lock()\r\n\t\t\tidleWorkers = p.workers\r\n\t\t\tl := len(idleWorkers) - 1\r\n\t\t\tif l < 0 {\r\n\t\t\t\tp.lock.Unlock()\r\n\t\t\t\tcontinue\r\n\t\t\t}\r\n\t\t\tw = idleWorkers[l]\r\n\t\t\tidleWorkers[l] = nil\r\n\t\t\tp.workers = idleWorkers[:l]\r\n\t\t\tp.lock.Unlock()\r\n\t\t\tbreak\r\n\t\t}\r\n```\r\n一直会continue,直到有空闲的worker,这样会阻塞调用Submit的goroutine.""",github:GithubUser:1:12890888,2018-09-27T09:13:01.000+00:00 -github:GithubIssue:1:425061837,github:GithubIssue:1:356703393,"""![snip20180927_3](https://user-images.githubusercontent.com/12890888/46144182-c4efe200-c28e-11e8-8e69-ffd4502e3b9e.png)\r\n\r\ncpu占用率一直接近100%\r\n\r\n![snip20180927_4](https://user-images.githubusercontent.com/12890888/46144221-ddf89300-c28e-11e8-985b-48437eb20cdc.png)\r\n""",github:GithubUser:1:12890888,2018-09-27T11:53:26.000+00:00 -github:GithubIssue:1:425062926,github:GithubIssue:1:364361014,"""tag更新了,v3.7\r\n\r\nAndy Pan 于2018年9月27日周四 下午5:00写道:\r\n\r\n> 我晚上回去就打一下新的tag,完了我再给你回一个邮件\r\n>\r\n> edcismybrother 于2018年9月27日周四 下午4:32写道:\r\n>\r\n>> 鄙人现在在弄dep依赖管理,有用到你写的ants项目,可是你好像忘记打最新的tag了。最新的tag\r\n>> 3.6是指向ed55924这个提交,git上的最新代码是af376f1b这次提交,两次提交都隔了快5个月了,看到的话,麻烦打一个最新的tag吧。(手动可怜)\r\n>>\r\n>> —\r\n>> You are receiving this because you are subscribed to this thread.\r\n>> Reply to this email directly, view it on GitHub\r\n>> , or mute the thread\r\n>> \r\n>> .\r\n>>\r\n>\r\n""",github:GithubUser:1:7496278,2018-09-27T11:57:31.000+00:00 -github:GithubIssue:1:425066089,github:GithubIssue:1:356703393,"""@liyonglion 这个例子看起来有点极端,因为只有两个任务,pool容量是1,所以剩下那个不断在自己加锁解锁导致cpu忙,如果是多个竞争的大部分是block状态,应该不会出现这种cpu满的情况,不然你把例子改改?增加提交的任务数再看看,看看还会不会出现这种情况。""",github:GithubUser:1:7496278,2018-09-27T12:07:30.000+00:00 -github:GithubIssue:1:425288734,github:GithubIssue:1:356703393,"""@panjf2000 ants比较适合做“短期”任务,如果存在大量的“长期”任务,很有可能导致死循环。为什么不block当前Submit的“线程”?""",github:GithubUser:1:12890888,2018-09-28T01:09:40.000+00:00 -github:GithubIssue:1:425293042,github:GithubIssue:1:356703393,"""@liyonglion 之前有用过chan阻塞等待,但是导致了一个死锁问题:#6,后来才改成这种形式。所以我说的增加submit的任务数再测试之后也是cpu 100%吗?这个问题我现在暂时没想到比较好的解决办法,我再想想,或者你有没有比较好的想法?可以提个pr。""",github:GithubUser:1:7496278,2018-09-28T01:37:17.000+00:00 -github:GithubIssue:1:425331360,github:GithubIssue:1:364361014,"""@panjf2000 可以的,谢谢啦""",github:GithubUser:1:29452204,2018-09-28T06:05:58.000+00:00 -github:GithubIssue:1:425409255,github:GithubIssue:1:356703393,"""@panjf2000 我提交了一个pr,你看下是否合理?我自己跑了上面的用例,没有问题。效率方面我还没有具体测试。""",github:GithubUser:1:12890888,2018-09-28T11:41:08.000+00:00 -github:GithubIssue:1:425423023,github:GithubIssue:1:356703393,"""@liyonglion 我看修改的代码应该是正确的,但是有两个问题:\r\n1. 要正确测试你pr,你要把ants_test.go里import ants的路径改成你自己的路径;\r\n2.你现在只修改了pool.go的代码,麻烦把pool_func.go里相应的地方也优化一下。""",github:GithubUser:1:7496278,2018-09-28T12:41:27.000+00:00 -github:GithubIssue:1:439792581,github:GithubIssue:1:382039050,"""GOMAXPROCS你可以理解成是G-P-M模型中的M的数量,也就是最大并行数。""",github:GithubUser:1:7496278,2018-11-19T07:10:47.000+00:00 -github:GithubIssue:1:439793939,github:GithubIssue:1:381941219,"""release的确有这个问题,目前还没有比较好的办法,只是等待定时销毁的那个goroutine去释放内存,你要是有兴趣可以再想想有没有更好的办法,可以提个pr""",github:GithubUser:1:7496278,2018-11-19T07:18:05.000+00:00 -github:GithubIssue:1:440207809,github:GithubIssue:1:382574800,"""https://github.com/panjf2000/ants/blob/711dbdb7a222771ce15aaee1bb7b7c6e9731f208/pool.go#L119""",github:GithubUser:1:5668717,2018-11-20T09:41:24.000+00:00 -github:GithubIssue:1:440263871,github:GithubIssue:1:382574800,"""这里可以讨论下,是否可以在任务函数里通过闭包的形式,将结果存入channel,满足你的需求?""",github:GithubUser:1:7496278,2018-11-20T12:56:13.000+00:00 -github:GithubIssue:1:440500490,github:GithubIssue:1:382574800,"""> 这里可以讨论下,是否可以在任务函数里通过闭包的形式,将结果存入channel,满足你的需求?\r\n\r\n可以的。但不仅仅如此,最重要的是想得到哪条消息失败了,方便进行❓下次延时处理或丢回队列。""",github:GithubUser:1:5668717,2018-11-21T02:00:22.000+00:00 -github:GithubIssue:1:440541883,github:GithubIssue:1:382574800,"""目前可以通过参数来传入处理失败的chan\r\n\r\ntype msg struct {\r\n……\r\nFailed chan<- *msg\r\n}\r\n\r\n// payload == &msg\r\npool,_:= NewPoolWithFunc(10,func(payload interface{}) error{\r\n……\r\n// 失败的话payload 发送到 Failed chan\r\n})\r\n\r\npool.Serve(msg)""",github:GithubUser:1:7931755,2018-11-21T05:57:51.000+00:00 -github:GithubIssue:1:440605531,github:GithubIssue:1:382574800,"""> 目前可以通过参数来传入处理失败的chan\r\n> \r\n> type msg struct {\r\n> ……\r\n> Failed chan<- *msg\r\n> }\r\n> \r\n> // payload == &msg\r\n> pool,_:= NewPoolWithFunc(10,func(payload interface{}) error{\r\n> ……\r\n> // 失败的话payload 发送到 Failed chan\r\n> })\r\n> \r\n> pool.Serve(msg)\r\n\r\n我目前的做法是没有用 `NewPoolWithFunc()`,而是用的 `ants.NewPool()`,控制整个服务只有一个`pool`,所有的任务都是从大`pool`里取:\r\n\r\n```\r\nfunc (w *Worker) Register(fn func() error, opts ...Option) error {\r\n\t// w.Workers = append(w.Workers, runtime.FuncForPC(reflect.ValueOf(fn).Pointer()).Name())\r\n\top := Op{}\r\n\top.applyOpts(opts)\r\n\r\n\tif op.GoroutineSize <= 1 {\r\n\t\treturn w.Pool.Submit(fn)\r\n\t}\r\n\r\n\tfor i := 0; i < op.GoroutineSize; i++ {\r\n\t\tw.Pool.Submit(fn)\r\n\t}\r\n\r\n\treturn nil\r\n}\r\n```\r\n想基于这种方式来处理失败任务的逻辑。可有方式实现?\r\n\r\n还有任务依赖也是我面临的问题,比如A任务依赖其它N个任务执行完成或者必须执行成功/失败后,触发A任务。当然解决这个问题并非必须靠`ants`框架层面实现,也可以业务实现,如果`ants`框架层面能解决是最完美的。\r\n\r\n不知道你怎么认为。\r\n""",github:GithubUser:1:5668717,2018-11-21T10:01:45.000+00:00 -github:GithubIssue:1:440876192,github:GithubIssue:1:382574800,"""错误返回,按照ants的设计,其实应该是异步的,目前没办法直接return error到调用的函数里,所以我觉得就算是处理也应该是异步的方式;至于任务依赖,❓目前想到的有两种办法:1.回调函数;2.消息通知(通过channel或消息队列),至于是不是要把这些复杂的逻辑加到ants里,有待商榷,或者你也可以推一个pr,大家一起探讨下~~""",github:GithubUser:1:7496278,2018-11-22T01:09:56.000+00:00 -github:GithubIssue:1:442366878,github:GithubIssue:1:381941219,"""在 pool里面加上一个 waitgroup,每次 启动一个 work,调用 waitgroup.Add(),协程执行完了就执行waitgroup.Done()。在release时候调用waitgroup.Wait()。最后再回收空闲 worker。不过b如果 worker 对于的 func 执行时间过长,会导致release一直等待。""",github:GithubUser:1:32898629,2018-11-28T08:48:17.000+00:00 -github:GithubIssue:1:445462719,github:GithubIssue:1:388907811,"""你的go版本是多少?""",github:GithubUser:1:7496278,2018-12-08T14:20:26.000+00:00 -github:GithubIssue:1:445496131,github:GithubIssue:1:388907811,"""go version go1.11.1 darwin/amd64\r\n\r\n我也尝试了将几个参数调小一点,结果都是 Semaphore 和 AntsPool 量级上都是差不多的""",github:GithubUser:1:720086,2018-12-08T22:56:54.000+00:00 -github:GithubIssue:1:445815378,github:GithubIssue:1:388907811,"""嗯,的确是一个量级。\r\nants的优势是:\r\n1. 内存消耗会小(并发量大的时候几乎可以节省一半的内存量);\r\n2. goroutine常驻内存(定时清理长时间空置的goroutine,按最后使用时间排序,最久未使用的goroutine最先被清理,进一步降低资源消耗);\r\n3. ants pool更加灵活可控,可动态调整pool size、手动销毁pool;\r\n4. 还有各类方法获取正在运行的goroutine数量、可用的goroutine数量,使并发程序更精确可控;\r\n......""",github:GithubUser:1:7496278,2018-12-10T13:30:04.000+00:00 -github:GithubIssue:1:446447291,github:GithubIssue:1:388907811,"""好的,怎么样测试内存消耗呢?按我理解大家活跃的 go routines 是一样的数目,为什么 ants 的内存消耗会小呢?""",github:GithubUser:1:720086,2018-12-12T03:18:44.000+00:00 -github:GithubIssue:1:446453643,github:GithubIssue:1:388907811,"""加上benchmem=true参数;至于为什么内存会更小,是因为在pool里的goroutines是常驻内存的,新的任务是复用goroutine的,而用sema的话只是限制了活跃的goroutine数量,并没有复用,新的任务还是会生成新的goroutine。""",github:GithubUser:1:7496278,2018-12-12T03:58:29.000+00:00 -github:GithubIssue:1:456022133,github:GithubIssue:1:401277739,"""合理的需求,可以加。我这两天加下。""",github:GithubUser:1:7496278,2019-01-21T10:21:24.000+00:00 -github:GithubIssue:1:456022560,github:GithubIssue:1:401277739,"""你要有兴趣也可以自己做,然后提个PR。""",github:GithubUser:1:7496278,2019-01-21T10:22:39.000+00:00 -github:GithubIssue:1:459948887,github:GithubIssue:1:405951301,"""@jiashiwen \r\nIt works on my side, pls make sure that you run the example on top of the latest ants code, thanks.""",github:GithubUser:1:7496278,2019-02-02T09:03:51.000+00:00 -github:GithubIssue:1:468919580,github:GithubIssue:1:413968505,"""不会的,incRunning操作总是在比较大小之后才发生的。""",github:GithubUser:1:7496278,2019-03-02T13:14:05.000+00:00 -github:GithubIssue:1:471299071,github:GithubIssue:1:419183961,"""server接收的并发请求量有多大?""",github:GithubUser:1:7496278,2019-03-10T13:18:01.000+00:00 -github:GithubIssue:1:471869506,github:GithubIssue:1:419268851,"""加锁后资源消耗会增加,性能会下降很多,所以是加锁确保池数量还是不加锁保证性能呢?""",github:GithubUser:1:29243953,2019-03-12T06:06:39.000+00:00 +github:GithubIssue:1:409800144,github:GithubIssue:1:346842831,"""这里freeSignal和idleWorkers的数量是绝对匹配的,也就是说,只要freeSignal有值那么idleWorkers里肯定有可用worker可以取出来,putWorker就是把可用worker放回idleWorkers,每次都会塞一个值进freeSignal,还有每次从idleWorkers里取一个worker都要取出freeSignal对应的一个值,不存在有可用worker却被freeSignal阻塞""",github:GithubAccount:1:7496278,2018-08-02T04:13:09.000+00:00 +github:GithubIssue:1:410141732,github:GithubIssue:1:347255859,"""切片如下\r\n\r\n这里等待锁\r\n9913 @ 0x42c73a 0x42c7ee 0x43cf64 0x43cc7d 0x46dfe8 0x7b28e0 0x7b2be5 0x4591f1\r\n#\t0x43cc7c\tsync.runtime_SemacquireMutex+0x3c\t\t\t\tE:/go/src/runtime/sema.go:71\r\n#\t0x46dfe7\tsync.(*Mutex).Lock+0x107\t\t\t\t\tE:/go/src/sync/mutex.go:134\r\n#\t0x7b28df\tmp/vendor/github.com/panjf2000/ants.(*Pool).putWorker+0x6f\tF:/gowork/src/mp/vendor/github.com/panjf2000/ants/pool.go:229\r\n#\t0x7b2be4\tmp/vendor/github.com/panjf2000/ants.(*Worker).run.func1+0x54\tF:/gowork/src/mp/vendor/github.com/panjf2000/ants/worker.go:53\r\n\r\n\r\n//这里占用了锁无法释放\r\n1 @ 0x42c73a 0x42c7ee 0x404212 0x403ecb 0x7b27df 0x7b23e2 0x7f694a 0x7f68e1 0x4591f1\r\n#\t0x7b27de\tmp/vendor/github.com/panjf2000/ants.(*Pool).getWorker+0x22e\tF:/gowork/src/mp/vendor/github.com/panjf2000/ants/pool.go:199\r\n#\t0x7b23e1\tmp/vendor/github.com/panjf2000/ants.(*Pool).Submit+0x61\t\tF:/gowork/src/mp/vendor/github.com/panjf2000/ants/pool.go:125\r\n\r\n\r\n""",github:GithubAccount:1:13118848,2018-08-03T04:33:23.000+00:00 +github:GithubIssue:1:410143221,github:GithubIssue:1:347255859,"""加了锁之后有下标溢出了。。。\r\npanic: runtime error: index out of range\r\n\r\ngoroutine 7 [running]:\r\nmp/vendor/github.com/panjf2000/ants.(*Pool).getWorker(0xc4200b6460, 0xc4202a6e01)\r\n\tF:/gowork/src/mp/vendor/github.com/panjf2000/ants/pool.go:213 +0x2ce\r\nmp/vendor/github.com/panjf2000/ants.(*Pool).Submit(0xc4200b6460, 0xc4223d47d0, 0x0, 0x0)\r\n\tF:/gowork/src/mp/vendor/github.com/panjf2000/ants/pool.go:125 +0x62\r\n""",github:GithubAccount:1:13118848,2018-08-03T04:46:13.000+00:00 +github:GithubIssue:1:410147487,github:GithubIssue:1:347255859,"""@lovelly 我查了源码,怎么行数和你说的有点对不上,你的代码更新到最新了吗?""",github:GithubAccount:1:7496278,2018-08-03T05:21:03.000+00:00 +github:GithubIssue:1:410170764,github:GithubIssue:1:347255859,"""😄 😄 😄 是最新的代码,我有添加一些print 所以行数不一样,这确实是一个bug 9913个协程阻塞在了 putWorker 很久很久。,。。。""",github:GithubAccount:1:13118848,2018-08-03T07:33:21.000+00:00 +github:GithubIssue:1:410173358,github:GithubIssue:1:347255859,"""![image](https://user-images.githubusercontent.com/13118848/43630582-44f48000-9733-11e8-936d-9cb0d4145204.png)\r\n 我idleWorkers 为空的, 但是我有n个协程阻塞在了 204行的\t<-p.freeSignal, 这时候来了一个worker被放入idleWorkers, 很巧的是一个协程在putWorker结束锁后,在190行的p.lock.Lock()拿到了锁,这时候 n := len(idleWorkers) - 1 结果是0 这个协程很高兴的进入了接下来的else分支, 然而不幸发生了,p.freeSignal的信号确被早已等在 204行的若干个协程中的一个拿走了, 那么 可怜的协程拿到了锁, 确无法等到 p.freeSignal p.freeSignal要拿到锁才能产生信号, 然后就。,。。""",github:GithubAccount:1:13118848,2018-08-03T07:44:32.000+00:00 +github:GithubIssue:1:410204870,github:GithubIssue:1:347255859,"""@lovelly 检查了一下,的确可能会有这个问题,这两天我会修复;\r\n另外,我测试的时候试过1000w的量都没发现过这个问题,可能是我每个任务的执行时间太短了,所以我想问下你的任务量有多大以及每个任务的耗时大概是多少?""",github:GithubAccount:1:7496278,2018-08-03T09:51:15.000+00:00 +github:GithubIssue:1:410205295,github:GithubIssue:1:347255859,"""😄 😄 😄 我任务耗时从0秒到60秒之间。。。""",github:GithubAccount:1:13118848,2018-08-03T09:53:00.000+00:00 +github:GithubIssue:1:410267195,github:GithubIssue:1:347255859,"""@lovelly 应该已经修复了,可以再试试""",github:GithubAccount:1:7496278,2018-08-03T14:15:45.000+00:00 +github:GithubIssue:1:410290418,github:GithubIssue:1:346842831,"""具体问题可以看 #6 """,github:GithubAccount:1:7496278,2018-08-03T15:32:00.000+00:00 +github:GithubIssue:1:411342200,github:GithubIssue:1:348630179,"""@huiwq1990 谢谢指出,今天会修复这个问题。""",github:GithubAccount:1:7496278,2018-08-08T09:17:30.000+00:00 +github:GithubIssue:1:411369513,github:GithubIssue:1:348630179,"""@huiwq1990 应该解决了,可以再试试""",github:GithubAccount:1:7496278,2018-08-08T11:06:55.000+00:00 +github:GithubIssue:1:411965696,github:GithubIssue:1:348630179,"""嗯,解决了""",github:GithubAccount:1:4555057,2018-08-10T03:35:53.000+00:00 +github:GithubIssue:1:411969260,github:GithubIssue:1:348630179,"""@huiwq1990 好的,那我关掉这个issue了。""",github:GithubAccount:1:7496278,2018-08-10T04:06:04.000+00:00 +github:GithubIssue:1:418287926,github:GithubIssue:1:356703393,"""会导致很多任务长时间在阻塞,至于cpu飙升应该不会""",github:GithubAccount:1:7496278,2018-09-04T08:40:06.000+00:00 +github:GithubIssue:1:418290090,github:GithubIssue:1:356703393,"""所以应该在goroutine中调用submit 否则会阻塞主任务""",github:GithubAccount:1:11763614,2018-09-04T08:47:39.000+00:00 +github:GithubIssue:1:418293975,github:GithubIssue:1:356703393,"""不是的,如果每一个submit都用一个goroutine那不就违背初衷了吗,这样的话你有多少个任务还是要启动多少个原生goroutine。""",github:GithubAccount:1:7496278,2018-09-04T09:00:55.000+00:00 +github:GithubIssue:1:418297020,github:GithubIssue:1:356703393,"""// Submit submits a task to this pool.\r\nfunc (p *Pool) Submit(task f) error {\r\n\tif len(p.release) > 0 {\r\n\t\treturn ErrPoolClosed\r\n\t}\r\n\tp.getWorker().task <- task\r\n\treturn nil\r\n}\r\n我是觉得p.getWorker() 阻塞不太好 ,这样主任务和pool没有彻底隔离""",github:GithubAccount:1:11763614,2018-09-04T09:11:37.000+00:00 +github:GithubIssue:1:425014962,github:GithubIssue:1:364361014,"""我晚上回去就打一下新的tag,完了我再给你回一个邮件\r\n\r\nedcismybrother 于2018年9月27日周四 下午4:32写道:\r\n\r\n> 鄙人现在在弄dep依赖管理,有用到你写的ants项目,可是你好像忘记打最新的tag了。最新的tag\r\n> 3.6是指向ed55924这个提交,git上的最新代码是af376f1b这次提交,两次提交都隔了快5个月了,看到的话,麻烦打一个最新的tag吧。(手动可怜)\r\n>\r\n> —\r\n> You are receiving this because you are subscribed to this thread.\r\n> Reply to this email directly, view it on GitHub\r\n> , or mute the thread\r\n> \r\n> .\r\n>\r\n""",github:GithubAccount:1:7496278,2018-09-27T09:00:40.000+00:00 +github:GithubIssue:1:425018770,github:GithubIssue:1:356703393,"""我觉得这个会导致cpu上升。调用Submit时,如果没有多余的worker,会一直进入这个死循环\r\n```\t\t\r\nfor {\r\n\t\t\tp.lock.Lock()\r\n\t\t\tidleWorkers = p.workers\r\n\t\t\tl := len(idleWorkers) - 1\r\n\t\t\tif l < 0 {\r\n\t\t\t\tp.lock.Unlock()\r\n\t\t\t\tcontinue\r\n\t\t\t}\r\n\t\t\tw = idleWorkers[l]\r\n\t\t\tidleWorkers[l] = nil\r\n\t\t\tp.workers = idleWorkers[:l]\r\n\t\t\tp.lock.Unlock()\r\n\t\t\tbreak\r\n\t\t}\r\n```\r\n一直会continue,直到有空闲的worker,这样会阻塞调用Submit的goroutine.""",github:GithubAccount:1:12890888,2018-09-27T09:13:01.000+00:00 +github:GithubIssue:1:425061837,github:GithubIssue:1:356703393,"""![snip20180927_3](https://user-images.githubusercontent.com/12890888/46144182-c4efe200-c28e-11e8-8e69-ffd4502e3b9e.png)\r\n\r\ncpu占用率一直接近100%\r\n\r\n![snip20180927_4](https://user-images.githubusercontent.com/12890888/46144221-ddf89300-c28e-11e8-985b-48437eb20cdc.png)\r\n""",github:GithubAccount:1:12890888,2018-09-27T11:53:26.000+00:00 +github:GithubIssue:1:425062926,github:GithubIssue:1:364361014,"""tag更新了,v3.7\r\n\r\nAndy Pan 于2018年9月27日周四 下午5:00写道:\r\n\r\n> 我晚上回去就打一下新的tag,完了我再给你回一个邮件\r\n>\r\n> edcismybrother 于2018年9月27日周四 下午4:32写道:\r\n>\r\n>> 鄙人现在在弄dep依赖管理,有用到你写的ants项目,可是你好像忘记打最新的tag了。最新的tag\r\n>> 3.6是指向ed55924这个提交,git上的最新代码是af376f1b这次提交,两次提交都隔了快5个月了,看到的话,麻烦打一个最新的tag吧。(手动可怜)\r\n>>\r\n>> —\r\n>> You are receiving this because you are subscribed to this thread.\r\n>> Reply to this email directly, view it on GitHub\r\n>> , or mute the thread\r\n>> \r\n>> .\r\n>>\r\n>\r\n""",github:GithubAccount:1:7496278,2018-09-27T11:57:31.000+00:00 +github:GithubIssue:1:425066089,github:GithubIssue:1:356703393,"""@liyonglion 这个例子看起来有点极端,因为只有两个任务,pool容量是1,所以剩下那个不断在自己加锁解锁导致cpu忙,如果是多个竞争的大部分是block状态,应该不会出现这种cpu满的情况,不然你把例子改改?增加提交的任务数再看看,看看还会不会出现这种情况。""",github:GithubAccount:1:7496278,2018-09-27T12:07:30.000+00:00 +github:GithubIssue:1:425288734,github:GithubIssue:1:356703393,"""@panjf2000 ants比较适合做“短期”任务,如果存在大量的“长期”任务,很有可能导致死循环。为什么不block当前Submit的“线程”?""",github:GithubAccount:1:12890888,2018-09-28T01:09:40.000+00:00 +github:GithubIssue:1:425293042,github:GithubIssue:1:356703393,"""@liyonglion 之前有用过chan阻塞等待,但是导致了一个死锁问题:#6,后来才改成这种形式。所以我说的增加submit的任务数再测试之后也是cpu 100%吗?这个问题我现在暂时没想到比较好的解决办法,我再想想,或者你有没有比较好的想法?可以提个pr。""",github:GithubAccount:1:7496278,2018-09-28T01:37:17.000+00:00 +github:GithubIssue:1:425331360,github:GithubIssue:1:364361014,"""@panjf2000 可以的,谢谢啦""",github:GithubAccount:1:29452204,2018-09-28T06:05:58.000+00:00 +github:GithubIssue:1:425409255,github:GithubIssue:1:356703393,"""@panjf2000 我提交了一个pr,你看下是否合理?我自己跑了上面的用例,没有问题。效率方面我还没有具体测试。""",github:GithubAccount:1:12890888,2018-09-28T11:41:08.000+00:00 +github:GithubIssue:1:425423023,github:GithubIssue:1:356703393,"""@liyonglion 我看修改的代码应该是正确的,但是有两个问题:\r\n1. 要正确测试你pr,你要把ants_test.go里import ants的路径改成你自己的路径;\r\n2.你现在只修改了pool.go的代码,麻烦把pool_func.go里相应的地方也优化一下。""",github:GithubAccount:1:7496278,2018-09-28T12:41:27.000+00:00 +github:GithubIssue:1:439792581,github:GithubIssue:1:382039050,"""GOMAXPROCS你可以理解成是G-P-M模型中的M的数量,也就是最大并行数。""",github:GithubAccount:1:7496278,2018-11-19T07:10:47.000+00:00 +github:GithubIssue:1:439793939,github:GithubIssue:1:381941219,"""release的确有这个问题,目前还没有比较好的办法,只是等待定时销毁的那个goroutine去释放内存,你要是有兴趣可以再想想有没有更好的办法,可以提个pr""",github:GithubAccount:1:7496278,2018-11-19T07:18:05.000+00:00 +github:GithubIssue:1:440207809,github:GithubIssue:1:382574800,"""https://github.com/panjf2000/ants/blob/711dbdb7a222771ce15aaee1bb7b7c6e9731f208/pool.go#L119""",github:GithubAccount:1:5668717,2018-11-20T09:41:24.000+00:00 +github:GithubIssue:1:440263871,github:GithubIssue:1:382574800,"""这里可以讨论下,是否可以在任务函数里通过闭包的形式,将结果存入channel,满足你的需求?""",github:GithubAccount:1:7496278,2018-11-20T12:56:13.000+00:00 +github:GithubIssue:1:440500490,github:GithubIssue:1:382574800,"""> 这里可以讨论下,是否可以在任务函数里通过闭包的形式,将结果存入channel,满足你的需求?\r\n\r\n可以的。但不仅仅如此,最重要的是想得到哪条消息失败了,方便进行❓下次延时处理或丢回队列。""",github:GithubAccount:1:5668717,2018-11-21T02:00:22.000+00:00 +github:GithubIssue:1:440541883,github:GithubIssue:1:382574800,"""目前可以通过参数来传入处理失败的chan\r\n\r\ntype msg struct {\r\n……\r\nFailed chan<- *msg\r\n}\r\n\r\n// payload == &msg\r\npool,_:= NewPoolWithFunc(10,func(payload interface{}) error{\r\n……\r\n// 失败的话payload 发送到 Failed chan\r\n})\r\n\r\npool.Serve(msg)""",github:GithubAccount:1:7931755,2018-11-21T05:57:51.000+00:00 +github:GithubIssue:1:440605531,github:GithubIssue:1:382574800,"""> 目前可以通过参数来传入处理失败的chan\r\n> \r\n> type msg struct {\r\n> ……\r\n> Failed chan<- *msg\r\n> }\r\n> \r\n> // payload == &msg\r\n> pool,_:= NewPoolWithFunc(10,func(payload interface{}) error{\r\n> ……\r\n> // 失败的话payload 发送到 Failed chan\r\n> })\r\n> \r\n> pool.Serve(msg)\r\n\r\n我目前的做法是没有用 `NewPoolWithFunc()`,而是用的 `ants.NewPool()`,控制整个服务只有一个`pool`,所有的任务都是从大`pool`里取:\r\n\r\n```\r\nfunc (w *Worker) Register(fn func() error, opts ...Option) error {\r\n\t// w.Workers = append(w.Workers, runtime.FuncForPC(reflect.ValueOf(fn).Pointer()).Name())\r\n\top := Op{}\r\n\top.applyOpts(opts)\r\n\r\n\tif op.GoroutineSize <= 1 {\r\n\t\treturn w.Pool.Submit(fn)\r\n\t}\r\n\r\n\tfor i := 0; i < op.GoroutineSize; i++ {\r\n\t\tw.Pool.Submit(fn)\r\n\t}\r\n\r\n\treturn nil\r\n}\r\n```\r\n想基于这种方式来处理失败任务的逻辑。可有方式实现?\r\n\r\n还有任务依赖也是我面临的问题,比如A任务依赖其它N个任务执行完成或者必须执行成功/失败后,触发A任务。当然解决这个问题并非必须靠`ants`框架层面实现,也可以业务实现,如果`ants`框架层面能解决是最完美的。\r\n\r\n不知道你怎么认为。\r\n""",github:GithubAccount:1:5668717,2018-11-21T10:01:45.000+00:00 +github:GithubIssue:1:440876192,github:GithubIssue:1:382574800,"""错误返回,按照ants的设计,其实应该是异步的,目前没办法直接return error到调用的函数里,所以我觉得就算是处理也应该是异步的方式;至于任务依赖,❓目前想到的有两种办法:1.回调函数;2.消息通知(通过channel或消息队列),至于是不是要把这些复杂的逻辑加到ants里,有待商榷,或者你也可以推一个pr,大家一起探讨下~~""",github:GithubAccount:1:7496278,2018-11-22T01:09:56.000+00:00 +github:GithubIssue:1:442366878,github:GithubIssue:1:381941219,"""在 pool里面加上一个 waitgroup,每次 启动一个 work,调用 waitgroup.Add(),协程执行完了就执行waitgroup.Done()。在release时候调用waitgroup.Wait()。最后再回收空闲 worker。不过b如果 worker 对于的 func 执行时间过长,会导致release一直等待。""",github:GithubAccount:1:32898629,2018-11-28T08:48:17.000+00:00 +github:GithubIssue:1:445462719,github:GithubIssue:1:388907811,"""你的go版本是多少?""",github:GithubAccount:1:7496278,2018-12-08T14:20:26.000+00:00 +github:GithubIssue:1:445496131,github:GithubIssue:1:388907811,"""go version go1.11.1 darwin/amd64\r\n\r\n我也尝试了将几个参数调小一点,结果都是 Semaphore 和 AntsPool 量级上都是差不多的""",github:GithubAccount:1:720086,2018-12-08T22:56:54.000+00:00 +github:GithubIssue:1:445815378,github:GithubIssue:1:388907811,"""嗯,的确是一个量级。\r\nants的优势是:\r\n1. 内存消耗会小(并发量大的时候几乎可以节省一半的内存量);\r\n2. goroutine常驻内存(定时清理长时间空置的goroutine,按最后使用时间排序,最久未使用的goroutine最先被清理,进一步降低资源消耗);\r\n3. ants pool更加灵活可控,可动态调整pool size、手动销毁pool;\r\n4. 还有各类方法获取正在运行的goroutine数量、可用的goroutine数量,使并发程序更精确可控;\r\n......""",github:GithubAccount:1:7496278,2018-12-10T13:30:04.000+00:00 +github:GithubIssue:1:446447291,github:GithubIssue:1:388907811,"""好的,怎么样测试内存消耗呢?按我理解大家活跃的 go routines 是一样的数目,为什么 ants 的内存消耗会小呢?""",github:GithubAccount:1:720086,2018-12-12T03:18:44.000+00:00 +github:GithubIssue:1:446453643,github:GithubIssue:1:388907811,"""加上benchmem=true参数;至于为什么内存会更小,是因为在pool里的goroutines是常驻内存的,新的任务是复用goroutine的,而用sema的话只是限制了活跃的goroutine数量,并没有复用,新的任务还是会生成新的goroutine。""",github:GithubAccount:1:7496278,2018-12-12T03:58:29.000+00:00 +github:GithubIssue:1:456022133,github:GithubIssue:1:401277739,"""合理的需求,可以加。我这两天加下。""",github:GithubAccount:1:7496278,2019-01-21T10:21:24.000+00:00 +github:GithubIssue:1:456022560,github:GithubIssue:1:401277739,"""你要有兴趣也可以自己做,然后提个PR。""",github:GithubAccount:1:7496278,2019-01-21T10:22:39.000+00:00 +github:GithubIssue:1:459948887,github:GithubIssue:1:405951301,"""@jiashiwen \r\nIt works on my side, pls make sure that you run the example on top of the latest ants code, thanks.""",github:GithubAccount:1:7496278,2019-02-02T09:03:51.000+00:00 +github:GithubIssue:1:468919580,github:GithubIssue:1:413968505,"""不会的,incRunning操作总是在比较大小之后才发生的。""",github:GithubAccount:1:7496278,2019-03-02T13:14:05.000+00:00 +github:GithubIssue:1:471299071,github:GithubIssue:1:419183961,"""server接收的并发请求量有多大?""",github:GithubAccount:1:7496278,2019-03-10T13:18:01.000+00:00 +github:GithubIssue:1:471869506,github:GithubIssue:1:419268851,"""加锁后资源消耗会增加,性能会下降很多,所以是加锁确保池数量还是不加锁保证性能呢?""",github:GithubAccount:1:29243953,2019-03-12T06:06:39.000+00:00 diff --git a/plugins/github/e2e/snapshot_tables/issues.csv b/plugins/github/e2e/snapshot_tables/issues.csv index 2bbd41b5199..df3d86ac3b0 100644 --- a/plugins/github/e2e/snapshot_tables/issues.csv +++ b/plugins/github/e2e/snapshot_tables/issues.csv @@ -1,27 +1,27 @@ id,url,icon_url,issue_key,title,description,epic_key,type,status,original_status,story_point,resolution_date,created_date,updated_date,lead_time_minutes,parent_issue_id,priority,original_estimate_minutes,time_spent_minutes,time_remaining_minutes,creator_id,creator_name,assignee_id,assignee_name,severity,component -github:GithubIssue:1:346842831,https://github.com/panjf2000/ants/issues/5,,5,关于 <-p.freeSignal 的疑惑,"""Hi,\r\n 我阅读了源码,对 `<-p.freeSignal` 这句代码有疑惑。 这句代码出现在了多个地方,freeSignal 的作用英文注释我是理解的,并且知道在 `putWorker` 中才进行 `p.freeSignal <- sig{}`\r\n\r\n对于下面的代码\r\n```\r\nfunc (p *Pool) getWorker() *Worker {\r\n\tvar w *Worker\r\n\twaiting := false\r\n\r\n\tp.lock.Lock()\r\n\tidleWorkers := p.workers\r\n\tn := len(idleWorkers) - 1\r\n\tif n < 0 { // 说明 pool中没有worker了\r\n\t\twaiting = p.Running() >= p.Cap()\r\n\t} else { // 说明pool中有worker\r\n\t\t<-p.freeSignal \r\n\t\tw = idleWorkers[n] \r\n\t\tidleWorkers[n] = nil\r\n\t\tp.workers = idleWorkers[:n]\r\n\t}\r\n\tp.lock.Unlock()\r\n\r\n\r\nfunc (p *Pool) Release() error {\r\n\tp.once.Do(func() { // 保证只释放一次\r\n\t\tp.release <- sig{}\r\n\t\tp.lock.Lock()\r\n\t\tidleWorkers := p.workers\r\n\t\tfor i, w := range idleWorkers {\r\n\t\t\t<-p.freeSignal\r\n\t\t\tw.task <- nil\r\n\t\t\tidleWorkers[i] = nil\r\n\t\t}\r\n\t\tp.workers = nil\r\n\t\tp.lock.Unlock()\r\n\t})\r\n\treturn nil\r\n}\r\n\r\n```\r\n\r\n中的 `<-p.freeSignal`, 那不是要等putWorker触发了才会继续进行吗?如果 putWorker不触发,就一直阻塞在那了,即使 idleWorkers 中可能是有worker的\r\n\r\n可否解释下这边的逻辑?谢谢""",,,DONE,,0,2018-08-03T15:32:00.000+00:00,2018-08-02T03:09:57.000+00:00,2018-08-10T04:06:36.000+00:00,2182,,,0,0,0,github:GithubUser:1:8605102,pathbox,github:GithubUser:1:0,,, -github:GithubIssue:1:347255859,https://github.com/panjf2000/ants/issues/6,,6,死锁bug,"""func (p *Pool) getWorker() *Worker 这个函数的 199行 \r\n必须先解锁在加锁, 要不然会产生死锁\r\n\r\n\tp.lock.Unlock()\r\n\t\t<-p.freeSignal\r\n\t\tp.lock.Lock()""",,BUG,DONE,,0,2018-08-04T10:18:41.000+00:00,2018-08-03T04:32:28.000+00:00,2018-08-04T10:18:41.000+00:00,1786,,,0,0,0,github:GithubUser:1:13118848,lovelly,github:GithubUser:1:0,,, -github:GithubIssue:1:348630179,https://github.com/panjf2000/ants/issues/7,,7,清理过期协程报错,"""你好,非常感谢提供这么好用的工具包。我在使用ants时,发现报异常。结果见下图\r\n![image](https://user-images.githubusercontent.com/4555057/43823431-98384444-9b21-11e8-880c-7458b931734a.png)\r\n日志是我在periodicallyPurge里加的调试信息\r\n![image](https://user-images.githubusercontent.com/4555057/43823534-e3c624a8-9b21-11e8-96c6-512e3e08db22.png)\r\n\r\n### 原因分析\r\n\r\n我认为可能原因是没有处理n==0的情况\r\n```\r\nif n > 0 {\r\n\tn++\r\n\tp.workers = idleWorkers[n:]\r\n}\r\n```\r\n\r\n\r\n### 测试代码\r\n```\r\npackage main\r\n\r\nimport (\r\n\t\""github.com/panjf2000/ants\""\r\n\t\""fmt\""\r\n\t\""time\""\r\n\t\""strconv\""\r\n)\r\n\r\nfunc main() {\r\n\r\n\tpool,err := ants.NewPool(100000)\r\n\r\n\tif err != nil {\r\n\t\tpanic(err)\r\n\t}\r\n\r\n\tfor i:=0;i<10000;i++{\r\n\t\tpool.Submit(\r\n\t\t\tfunc() error {\r\n\t\t\t\ttime.Sleep(1 * time.Millisecond)\r\n\t\t\t\tfmt.Println(strconv.Itoa(i))\r\n\t\t\t\treturn nil\r\n\t\t\t})\r\n\t}\r\n\r\n\tfor{\r\n\t\tpool.Submit(\r\n\t\t\tfunc() error {\r\n\t\t\t\ttime.Sleep(10 * time.Millisecond)\r\n\t\t\treturn nil\r\n\t\t})\r\n\t\ttime.Sleep(1 * time.Millisecond)\r\n\t}\r\n}\r\n```""",,BUG,DONE,,0,2018-08-10T04:06:04.000+00:00,2018-08-08T08:43:15.000+00:00,2018-08-10T04:06:04.000+00:00,2602,,,0,0,0,github:GithubUser:1:4555057,huiwq1990,github:GithubUser:1:0,,, -github:GithubIssue:1:356703393,https://github.com/panjf2000/ants/issues/10,,10,高并发下设定较小的worker数量问题,"""会存在cpu飚升的问题吧?""",,,DONE,,0,2018-09-29T11:45:00.000+00:00,2018-09-04T08:26:55.000+00:00,2018-09-29T11:45:00.000+00:00,36198,,,0,0,0,github:GithubUser:1:11763614,Moonlight-Zhao,github:GithubUser:1:0,,, -github:GithubIssue:1:364361014,https://github.com/panjf2000/ants/issues/12,,12,潘少,更新下tag吧,"""鄙人现在在弄dep依赖管理,有用到你写的ants项目,可是你好像忘记打最新的tag了。最新的tag 3.6是指向ed55924这个提交,git上的最新代码是af376f1b这次提交,两次提交都隔了快5个月了,看到的话,麻烦打一个最新的tag吧。(手动可怜)""",,,DONE,,0,2018-09-28T06:05:58.000+00:00,2018-09-27T08:32:25.000+00:00,2019-04-21T08:19:58.000+00:00,1293,,,0,0,0,github:GithubUser:1:29452204,edcismybrother,github:GithubUser:1:0,,, -github:GithubIssue:1:381941219,https://github.com/panjf2000/ants/issues/17,,17,关于优雅退出的问题,"""关于这个package优雅退出的问题,我看了一下Release的代码:\r\n\r\n`\r\n\t// Release Closed this pool.\r\n\tfunc (p *PoolWithFunc) Release() error {\r\n\t\tp.once.Do(func() {\r\n\t\t\tp.release <- sig{}\r\n\t\t\tp.lock.Lock()\r\n\t\t\tidleWorkers := p.workers\r\n\t\t\tfor i, w := range idleWorkers {\r\n\t\t\t\tw.args <- nil\r\n\t\t\t\tidleWorkers[i] = nil\r\n\t\t\t}\r\n\t\t\tp.workers = nil\r\n\t\t\tp.lock.Unlock()\r\n\t\t})\r\n\t\treturn nil\r\n\t}\r\n`\r\n\r\nrelease中,好像没有去等待那些已经正在工作的worker处理完它们的工作?\r\n仅仅是回收了空闲的worker\r\n\r\n那么在收到程序退出的信号时候,release是不能确保正在工作的worker能妥善完成工作\r\n\r\n如果想实现比较好退出方式目前好像是:\r\n\r\nReSize(0) \r\n\r\n不知道我理解的对不对?\r\n""",,,DONE,,0,2019-01-29T07:24:37.000+00:00,2018-11-18T08:50:31.000+00:00,2019-01-29T07:24:37.000+00:00,103594,,,0,0,0,github:GithubUser:1:7931755,zplzpl,github:GithubUser:1:0,,, -github:GithubIssue:1:382039050,https://github.com/panjf2000/ants/issues/18,,18,go协程的理解,"""你好楼主,向您请教一个协程和线程的问题,协程基于go进程调度,线程基于系统内核调度,调度协程的过程是先调度线程后获得资源再去调度协程。\""官方解释: GOMAXPROCS sets the maximum number of CPUs that can be executing simultaneously。限制cpu数,本质上是什么,限制并行数?,并行数即同时执行数量?,执行单元即线程?,即限制最大并行线程数量?\""""",,,DONE,,0,2018-12-03T03:53:50.000+00:00,2018-11-19T02:59:53.000+00:00,2018-12-03T03:53:50.000+00:00,20213,,,0,0,0,github:GithubUser:1:13944100,LinuxForYQH,github:GithubUser:1:0,,, -github:GithubIssue:1:382574800,https://github.com/panjf2000/ants/issues/20,,20,是否考虑任务支持回调函数处理失败的逻辑和任务依赖,"""#""",,,DONE,,0,2019-01-25T15:34:03.000+00:00,2018-11-20T09:36:02.000+00:00,2019-01-25T15:34:03.000+00:00,95398,,,0,0,0,github:GithubUser:1:5668717,kklinan,github:GithubUser:1:0,,, -github:GithubIssue:1:388907811,https://github.com/panjf2000/ants/issues/21,,21,Benchmark 下直接使用 Semaphore 似乎更快呢?,"""简单跑了一下 benchmark,Semaphore 更快且很简单\r\n\r\n```bash\r\n$ go test -bench .\r\ngoos: darwin\r\ngoarch: amd64\r\npkg: github.com/panjf2000/ants\r\nBenchmarkGoroutineWithFunc-4 \t 1\t3445631705 ns/op\r\nBenchmarkSemaphoreWithFunc-4 \t 1\t1037219073 ns/op\r\nBenchmarkAntsPoolWithFunc-4 \t 1\t1138053222 ns/op\r\nBenchmarkGoroutine-4 \t 2\t 731850771 ns/op\r\nBenchmarkSemaphore-4 \t 2\t 914855967 ns/op\r\nBenchmarkAntsPool-4 \t 1\t1094379445 ns/op\r\nPASS\r\nok \tgithub.com/panjf2000/ants\t33.173s\r\n```\r\n那 Ants 在什么情况下有优势呢?""",,,DONE,,0,2018-12-14T06:01:07.000+00:00,2018-12-08T10:08:17.000+00:00,2018-12-14T06:01:07.000+00:00,8392,,,0,0,0,github:GithubUser:1:720086,huangjunwen,github:GithubUser:1:0,,, -github:GithubIssue:1:401277739,https://github.com/panjf2000/ants/issues/22,,22,是否考虑 worker 中添加 PanicHandler ?,"""比方说在创建 Pool 的时候传入一个 PanicHandler,然后在每个 worker 创建的时候 recover 之后传给 PanicHandler 处理。否则池子里如果发生 panic 会直接挂掉整个进程。""",,,DONE,,0,2019-01-22T05:41:34.000+00:00,2019-01-21T10:06:56.000+00:00,2019-01-22T05:41:34.000+00:00,1174,,,0,0,0,github:GithubUser:1:8923413,choleraehyq,github:GithubUser:1:0,,, -github:GithubIssue:1:402513849,https://github.com/panjf2000/ants/issues/24,,24,提交任务不阻塞,"""`Pool.Submit`和`PoolWithFunc.Server`提交任务,如果没有空的worker,会一直阻塞。建议增加不阻塞的接口,当前失败时直接返回错误。""",,,DONE,,0,2019-08-20T10:56:30.000+00:00,2019-01-24T02:24:13.000+00:00,2019-08-20T10:56:30.000+00:00,300032,,,0,0,0,github:GithubUser:1:5044825,tenfyzhong,github:GithubUser:1:0,,, -github:GithubIssue:1:405951301,https://github.com/panjf2000/ants/issues/25,,25,use example errors,"""./antstest.go:37:14: cannot use syncCalculateSum (type func()) as type ants.f in argument to ants.Submit\r\n./antstest.go:45:35: cannot use func literal (type func(interface {})) as type ants.pf in argument to ants.NewPoolWithFunc\r\n""",,,DONE,,0,2019-02-04T09:11:52.000+00:00,2019-02-02T05:43:38.000+00:00,2019-02-04T09:11:52.000+00:00,3088,,,0,0,0,github:GithubUser:1:5244267,jiashiwen,github:GithubUser:1:0,,, -github:GithubIssue:1:413968505,https://github.com/panjf2000/ants/issues/26,,26,running可能大于cap的问题,"""running与cap的比较判断与incRuning分开执行的, 可能会出现running大于cap的问题?\r\n`func (p *Pool) retrieveWorker() *Worker {\r\n\tvar w *Worker\r\n\r\n\tp.lock.Lock()\r\n\tidleWorkers := p.workers\r\n\tn := len(idleWorkers) - 1\r\n\tif n >= 0 {\r\n\t\tw = idleWorkers[n]\r\n\t\tidleWorkers[n] = nil\r\n\t\tp.workers = idleWorkers[:n]\r\n\t\tp.lock.Unlock()\r\n\t} else if p.Running() < p.Cap() {\r\n\t\tp.lock.Unlock()\r\n\t\tif cacheWorker := p.workerCache.Get(); cacheWorker != nil {\r\n\t\t\tw = cacheWorker.(*Worker)\r\n\t\t} else {\r\n\t\t\tw = &Worker{\r\n\t\t\t\tpool: p,\r\n\t\t\t\ttask: make(chan func(), workerChanCap),\r\n\t\t\t}\r\n\t\t}\r\n\t\tw.run()`""",,,DONE,,0,2019-03-12T12:01:57.000+00:00,2019-02-25T07:29:33.000+00:00,2019-03-12T12:01:57.000+00:00,21872,,,0,0,0,github:GithubUser:1:10361713,Ainiroad,github:GithubUser:1:0,,, -github:GithubIssue:1:419183961,https://github.com/panjf2000/ants/issues/27,,27,为何goroutine一直上不去,用户量也打不上去,"""为何goroutine一直上不去,用户量也打不上去\r\n是我用的有问题吗?\r\n\r\nwebsocket server\r\nhttps://github.com/im-ai/pushm/blob/master/learn/goroutine/goroutinepoolwebsocket.go\r\n\r\nwebsocket cient\r\nhttps://github.com/im-ai/pushm/blob/master/learn/goroutine/goroutinepoolwebsocketclient.go\r\n""",,,DONE,,0,2019-04-05T14:05:20.000+00:00,2019-03-10T13:08:52.000+00:00,2019-04-05T14:05:20.000+00:00,37496,,,0,0,0,github:GithubUser:1:38367404,liliang8858,github:GithubUser:1:0,,, -github:GithubIssue:1:419268851,https://github.com/panjf2000/ants/issues/28,,28,cap 和 running 比较的问题,"""这是我在 Playground 上面的代码 https://play.golang.org/p/D94YUU3FnX6\r\natomic 只能保证自增自减时的原子操作,在比较过程中,其他线程对变量进行了操作 比较过程并无感知,所以这个比较结果 不是完全正确的,想要实现 比较的数量完全正确,只能在修改和比较两个值的地方加锁\r\n像 #26 说的是对的""",,,DONE,,0,2019-08-22T16:27:37.000+00:00,2019-03-11T02:24:41.000+00:00,2019-08-22T16:27:37.000+00:00,237002,,,0,0,0,github:GithubUser:1:29243953,naiba,github:GithubUser:1:0,,, -github:GithubIssue:1:424634533,https://github.com/panjf2000/ants/issues/29,,29,任务传参,"""你好,你的项目太酷了👍\r\n\r\nhttps://github.com/panjf2000/ants/blob/master/pool.go#L124 貌似不支持带参数的任务, 请问传参是用闭包的方式吗?\r\n""",,,DONE,,0,2019-03-25T09:32:11.000+00:00,2019-03-24T16:52:21.000+00:00,2019-03-25T09:45:05.000+00:00,999,,,0,0,0,github:GithubUser:1:8509898,prprprus,github:GithubUser:1:0,,, -github:GithubIssue:1:429972115,https://github.com/panjf2000/ants/issues/31,,31,Add go.mod,"""""",,,DONE,,0,2019-04-08T09:45:31.000+00:00,2019-04-05T23:50:36.000+00:00,2019-10-17T03:12:19.000+00:00,3474,,,0,0,0,github:GithubUser:1:48135919,tsatke,github:GithubUser:1:0,,, -github:GithubIssue:1:433564955,https://github.com/panjf2000/ants/issues/32,,32,关于版本问题,我发现小版本(0.0.x)这种更新就会不向下兼容?,"""如题,我感觉这样不好。\r\n\r\n功能版本号不向下兼容能理解\r\n\r\n修复问题的版本号也不向下兼容,难以理解。""",,,DONE,,0,2019-04-21T07:16:26.000+00:00,2019-04-16T03:16:02.000+00:00,2019-04-21T07:16:26.000+00:00,7440,,,0,0,0,github:GithubUser:1:7931755,zplzpl,github:GithubUser:1:0,,, -github:GithubIssue:1:434069015,https://github.com/panjf2000/ants/issues/33,,33,support semantic versioning.,"""建议将发布的tag兼容为semantic versioning,vX.Y.Z。go modules对此支持比较良好。\r\nhttps://semver.org/\r\nhttps://research.swtch.com/vgo-import""",,,DONE,,0,2019-04-21T08:25:20.000+00:00,2019-04-17T02:55:11.000+00:00,2019-04-21T08:25:20.000+00:00,6090,,,0,0,0,github:GithubUser:1:1284892,jjeffcaii,github:GithubUser:1:0,,, -github:GithubIssue:1:435486645,https://github.com/panjf2000/ants/issues/34,,34,Important announcement about from author !!!,"""**Dear users of `ants`:**\r\nI am apologetically telling you that I have to dump all tags which already presents in `ants` repository.\r\n\r\nThe reason why I'm doing so is to standardize the version management with `Semantic Versioning`, which will make a formal and clear dependency management in go, for go modules, godep, or glide, etc. So I decide to start over the tag sequence, you could find more details in [Semantic Versioning](https://semver.org/) and [Semantic Import Versioning](https://research.swtch.com/vgo-import), related issue: #32, #33 (very thankful to @jjeffcaii and @zplzpl who provided the suggestions about it).\r\n\r\nI ought to apologize for the bothers brought by this change, the arch-criminal who leads to this issue would be my lack of concept about `Semantic Versioning`, I will spend more times learning the knowledge afterwards. \r\n\r\nOnce again, sorry for your costs in this change and thanks for your support to `ants`! \r\n\r\n*Have fun!*\r\n\r\n**Best regards,\r\nAndy Pan**\r\n""",,,DONE,,0,2019-05-07T15:35:08.000+00:00,2019-04-21T08:10:28.000+00:00,2019-05-07T15:35:08.000+00:00,23484,,,0,0,0,github:GithubUser:1:7496278,panjf2000,github:GithubUser:1:0,,, -github:GithubIssue:1:461280653,https://github.com/panjf2000/ants/issues/35,,35,worker exit on panic,"""个人认为PanicHandler设计不妥。\r\n1.无PanicHandler时,抛出给外面的不是panic,外层感受不到。\r\n2.无论有没有PanicHandler,都会导致worker退出,最终pool阻塞住全部任务。""",,,DONE,,0,2019-08-17T20:33:10.000+00:00,2019-06-27T03:11:49.000+00:00,2019-08-17T20:33:10.000+00:00,74481,,,0,0,0,github:GithubUser:1:38849208,king526,github:GithubUser:1:0,,, -github:GithubIssue:1:462631417,https://github.com/panjf2000/ants/issues/37,,37,请不要再随意变更版本号了。。。,"""之前用的是 3.9.9,结果今天构建出了问题,一看发现这个版本没了,变成 1.0.0。这种变更完全不考虑现有用户的情况。希望以后不要随意变更了""",,,DONE,,0,2019-07-01T12:37:55.000+00:00,2019-07-01T10:17:15.000+00:00,2019-07-02T10:17:31.000+00:00,140,,,0,0,0,github:GithubUser:1:8923413,choleraehyq,github:GithubUser:1:0,,, -github:GithubIssue:1:472125082,https://github.com/panjf2000/ants/issues/38,,38,retrieveWorker与revertWorker之间会导致死锁,"""func (p *Pool) retrieveWorker() *Worker {\r\n\tvar w *Worker\r\n\r\n\t**p.lock.Lock()**\r\n\tidleWorkers := p.workers\r\n\tn := len(idleWorkers) - 1\r\n\tif n >= 0 {\r\n\t\tw = idleWorkers[n]\r\n\t\tidleWorkers[n] = nil\r\n\t\tp.workers = idleWorkers[:n]\r\n\t\tp.lock.Unlock()\r\n\t} else if p.Running() < p.Cap() {\r\n\t\tp.lock.Unlock()\r\n\t\tif cacheWorker := p.workerCache.Get(); cacheWorker != nil {\r\n\t\t\tw = cacheWorker.(*Worker)\r\n\t\t} else {\r\n\t\t\tw = &Worker{\r\n\t\t\t\tpool: p,\r\n\t\t\t\ttask: make(chan func(), workerChanCap),\r\n\t\t\t}\r\n\t\t}\r\n\t\tw.run()\r\n\t} else {\r\n\t\tfor {\r\n\t\t\t**p.cond.Wait()** \r\n\t\t\tl := len(p.workers) - 1\r\n\t\t\tif l < 0 {\r\n\t\t\t\tcontinue\r\n\t\t\t}\r\n\t\t\tw = p.workers[l]\r\n\t\t\tp.workers[l] = nil\r\n\t\t\tp.workers = p.workers[:l]\r\n\t\t\tbreak\r\n\t\t}\r\n\t\t**p.lock.Unlock()**\r\n\t}\r\n\treturn w\r\n}\r\n\r\n// revertWorker puts a worker back into free pool, recycling the goroutines.\r\nfunc (p *Pool) revertWorker(worker *Worker) bool {\r\n\tif CLOSED == atomic.LoadInt32(&p.release) {\r\n\t\treturn false\r\n\t}\r\n\tworker.recycleTime = time.Now()\r\n\t**p.lock.Lock()** // 协程池满了之后获取不到锁\r\n\tp.workers = append(p.workers, worker)\r\n\t// Notify the invoker stuck in 'retrieveWorker()' of there is an available worker in the worker queue.\r\n\tp.cond.Signal()\r\n\t**p.lock.Unlock()**\r\n\treturn true\r\n}\r\n""",,,DONE,,0,2019-07-24T08:40:01.000+00:00,2019-07-24T07:32:58.000+00:00,2019-07-24T08:40:01.000+00:00,67,,,0,0,0,github:GithubUser:1:1290360,wwjiang,github:GithubUser:1:0,,, -github:GithubIssue:1:483164833,https://github.com/panjf2000/ants/issues/42,,42,带选项的初始化函数,我觉得用 functional options 更好一点,"""以下是示意代码\r\n如果用 functional options,原来的写法是\r\n```\r\nants.NewPool(10)\r\n```\r\n新的写法,如果不加 option,写法是不变的,因为 options 是作为可变参数传进去的。如果要加 option,只需要改成\r\n```\r\nants.NewPool(10, ants.WithNonblocking(true))\r\n```\r\n这样。\r\n\r\n现在是直接传一个 Option 结构体进去,所有的地方都要改,感觉很不优雅。\r\n具体 functional options 的设计可以看 rob pike 的一篇博客 https://commandcenter.blogspot.com/2014/01/self-referential-functions-and-design.html""",,,DONE,,0,2019-08-21T14:32:51.000+00:00,2019-08-21T02:20:08.000+00:00,2019-08-21T14:32:51.000+00:00,732,,,0,0,0,github:GithubUser:1:8923413,choleraehyq,github:GithubUser:1:0,,, -github:GithubIssue:1:483736247,https://github.com/panjf2000/ants/issues/43,,43,1.3.0 是不兼容更新,"""Pool 里那些暴露出来的字段(PanicHandler 之类的)都没了,这是一个不兼容更新,根据语义化版本的要求要发大版本。""",,,DONE,,0,2019-08-22T13:22:10.000+00:00,2019-08-22T02:29:34.000+00:00,2019-08-22T13:22:10.000+00:00,652,,,0,0,0,github:GithubUser:1:8923413,choleraehyq,github:GithubUser:1:0,,, -github:GithubIssue:1:484311063,https://github.com/panjf2000/ants/issues/44,,44,1.1.1 -> 1.2.0 也是不兼容更新,"""Pool.Release 的返回值没了""",,,DONE,,0,2019-08-25T06:36:14.000+00:00,2019-08-23T03:27:38.000+00:00,2019-08-25T06:36:14.000+00:00,3068,,,0,0,0,github:GithubUser:1:8923413,choleraehyq,github:GithubUser:1:0,,, +github:GithubIssue:1:346842831,https://github.com/panjf2000/ants/issues/5,,5,关于 <-p.freeSignal 的疑惑,"""Hi,\r\n 我阅读了源码,对 `<-p.freeSignal` 这句代码有疑惑。 这句代码出现在了多个地方,freeSignal 的作用英文注释我是理解的,并且知道在 `putWorker` 中才进行 `p.freeSignal <- sig{}`\r\n\r\n对于下面的代码\r\n```\r\nfunc (p *Pool) getWorker() *Worker {\r\n\tvar w *Worker\r\n\twaiting := false\r\n\r\n\tp.lock.Lock()\r\n\tidleWorkers := p.workers\r\n\tn := len(idleWorkers) - 1\r\n\tif n < 0 { // 说明 pool中没有worker了\r\n\t\twaiting = p.Running() >= p.Cap()\r\n\t} else { // 说明pool中有worker\r\n\t\t<-p.freeSignal \r\n\t\tw = idleWorkers[n] \r\n\t\tidleWorkers[n] = nil\r\n\t\tp.workers = idleWorkers[:n]\r\n\t}\r\n\tp.lock.Unlock()\r\n\r\n\r\nfunc (p *Pool) Release() error {\r\n\tp.once.Do(func() { // 保证只释放一次\r\n\t\tp.release <- sig{}\r\n\t\tp.lock.Lock()\r\n\t\tidleWorkers := p.workers\r\n\t\tfor i, w := range idleWorkers {\r\n\t\t\t<-p.freeSignal\r\n\t\t\tw.task <- nil\r\n\t\t\tidleWorkers[i] = nil\r\n\t\t}\r\n\t\tp.workers = nil\r\n\t\tp.lock.Unlock()\r\n\t})\r\n\treturn nil\r\n}\r\n\r\n```\r\n\r\n中的 `<-p.freeSignal`, 那不是要等putWorker触发了才会继续进行吗?如果 putWorker不触发,就一直阻塞在那了,即使 idleWorkers 中可能是有worker的\r\n\r\n可否解释下这边的逻辑?谢谢""",,,DONE,,0,2018-08-03T15:32:00.000+00:00,2018-08-02T03:09:57.000+00:00,2018-08-10T04:06:36.000+00:00,2182,,,0,0,0,github:GithubAccount:1:8605102,pathbox,github:GithubAccount:1:0,,, +github:GithubIssue:1:347255859,https://github.com/panjf2000/ants/issues/6,,6,死锁bug,"""func (p *Pool) getWorker() *Worker 这个函数的 199行 \r\n必须先解锁在加锁, 要不然会产生死锁\r\n\r\n\tp.lock.Unlock()\r\n\t\t<-p.freeSignal\r\n\t\tp.lock.Lock()""",,BUG,DONE,,0,2018-08-04T10:18:41.000+00:00,2018-08-03T04:32:28.000+00:00,2018-08-04T10:18:41.000+00:00,1786,,,0,0,0,github:GithubAccount:1:13118848,lovelly,github:GithubAccount:1:0,,, +github:GithubIssue:1:348630179,https://github.com/panjf2000/ants/issues/7,,7,清理过期协程报错,"""你好,非常感谢提供这么好用的工具包。我在使用ants时,发现报异常。结果见下图\r\n![image](https://user-images.githubusercontent.com/4555057/43823431-98384444-9b21-11e8-880c-7458b931734a.png)\r\n日志是我在periodicallyPurge里加的调试信息\r\n![image](https://user-images.githubusercontent.com/4555057/43823534-e3c624a8-9b21-11e8-96c6-512e3e08db22.png)\r\n\r\n### 原因分析\r\n\r\n我认为可能原因是没有处理n==0的情况\r\n```\r\nif n > 0 {\r\n\tn++\r\n\tp.workers = idleWorkers[n:]\r\n}\r\n```\r\n\r\n\r\n### 测试代码\r\n```\r\npackage main\r\n\r\nimport (\r\n\t\""github.com/panjf2000/ants\""\r\n\t\""fmt\""\r\n\t\""time\""\r\n\t\""strconv\""\r\n)\r\n\r\nfunc main() {\r\n\r\n\tpool,err := ants.NewPool(100000)\r\n\r\n\tif err != nil {\r\n\t\tpanic(err)\r\n\t}\r\n\r\n\tfor i:=0;i<10000;i++{\r\n\t\tpool.Submit(\r\n\t\t\tfunc() error {\r\n\t\t\t\ttime.Sleep(1 * time.Millisecond)\r\n\t\t\t\tfmt.Println(strconv.Itoa(i))\r\n\t\t\t\treturn nil\r\n\t\t\t})\r\n\t}\r\n\r\n\tfor{\r\n\t\tpool.Submit(\r\n\t\t\tfunc() error {\r\n\t\t\t\ttime.Sleep(10 * time.Millisecond)\r\n\t\t\treturn nil\r\n\t\t})\r\n\t\ttime.Sleep(1 * time.Millisecond)\r\n\t}\r\n}\r\n```""",,BUG,DONE,,0,2018-08-10T04:06:04.000+00:00,2018-08-08T08:43:15.000+00:00,2018-08-10T04:06:04.000+00:00,2602,,,0,0,0,github:GithubAccount:1:4555057,huiwq1990,github:GithubAccount:1:0,,, +github:GithubIssue:1:356703393,https://github.com/panjf2000/ants/issues/10,,10,高并发下设定较小的worker数量问题,"""会存在cpu飚升的问题吧?""",,,DONE,,0,2018-09-29T11:45:00.000+00:00,2018-09-04T08:26:55.000+00:00,2018-09-29T11:45:00.000+00:00,36198,,,0,0,0,github:GithubAccount:1:11763614,Moonlight-Zhao,github:GithubAccount:1:0,,, +github:GithubIssue:1:364361014,https://github.com/panjf2000/ants/issues/12,,12,潘少,更新下tag吧,"""鄙人现在在弄dep依赖管理,有用到你写的ants项目,可是你好像忘记打最新的tag了。最新的tag 3.6是指向ed55924这个提交,git上的最新代码是af376f1b这次提交,两次提交都隔了快5个月了,看到的话,麻烦打一个最新的tag吧。(手动可怜)""",,,DONE,,0,2018-09-28T06:05:58.000+00:00,2018-09-27T08:32:25.000+00:00,2019-04-21T08:19:58.000+00:00,1293,,,0,0,0,github:GithubAccount:1:29452204,edcismybrother,github:GithubAccount:1:0,,, +github:GithubIssue:1:381941219,https://github.com/panjf2000/ants/issues/17,,17,关于优雅退出的问题,"""关于这个package优雅退出的问题,我看了一下Release的代码:\r\n\r\n`\r\n\t// Release Closed this pool.\r\n\tfunc (p *PoolWithFunc) Release() error {\r\n\t\tp.once.Do(func() {\r\n\t\t\tp.release <- sig{}\r\n\t\t\tp.lock.Lock()\r\n\t\t\tidleWorkers := p.workers\r\n\t\t\tfor i, w := range idleWorkers {\r\n\t\t\t\tw.args <- nil\r\n\t\t\t\tidleWorkers[i] = nil\r\n\t\t\t}\r\n\t\t\tp.workers = nil\r\n\t\t\tp.lock.Unlock()\r\n\t\t})\r\n\t\treturn nil\r\n\t}\r\n`\r\n\r\nrelease中,好像没有去等待那些已经正在工作的worker处理完它们的工作?\r\n仅仅是回收了空闲的worker\r\n\r\n那么在收到程序退出的信号时候,release是不能确保正在工作的worker能妥善完成工作\r\n\r\n如果想实现比较好退出方式目前好像是:\r\n\r\nReSize(0) \r\n\r\n不知道我理解的对不对?\r\n""",,,DONE,,0,2019-01-29T07:24:37.000+00:00,2018-11-18T08:50:31.000+00:00,2019-01-29T07:24:37.000+00:00,103594,,,0,0,0,github:GithubAccount:1:7931755,zplzpl,github:GithubAccount:1:0,,, +github:GithubIssue:1:382039050,https://github.com/panjf2000/ants/issues/18,,18,go协程的理解,"""你好楼主,向您请教一个协程和线程的问题,协程基于go进程调度,线程基于系统内核调度,调度协程的过程是先调度线程后获得资源再去调度协程。\""官方解释: GOMAXPROCS sets the maximum number of CPUs that can be executing simultaneously。限制cpu数,本质上是什么,限制并行数?,并行数即同时执行数量?,执行单元即线程?,即限制最大并行线程数量?\""""",,,DONE,,0,2018-12-03T03:53:50.000+00:00,2018-11-19T02:59:53.000+00:00,2018-12-03T03:53:50.000+00:00,20213,,,0,0,0,github:GithubAccount:1:13944100,LinuxForYQH,github:GithubAccount:1:0,,, +github:GithubIssue:1:382574800,https://github.com/panjf2000/ants/issues/20,,20,是否考虑任务支持回调函数处理失败的逻辑和任务依赖,"""#""",,,DONE,,0,2019-01-25T15:34:03.000+00:00,2018-11-20T09:36:02.000+00:00,2019-01-25T15:34:03.000+00:00,95398,,,0,0,0,github:GithubAccount:1:5668717,kklinan,github:GithubAccount:1:0,,, +github:GithubIssue:1:388907811,https://github.com/panjf2000/ants/issues/21,,21,Benchmark 下直接使用 Semaphore 似乎更快呢?,"""简单跑了一下 benchmark,Semaphore 更快且很简单\r\n\r\n```bash\r\n$ go test -bench .\r\ngoos: darwin\r\ngoarch: amd64\r\npkg: github.com/panjf2000/ants\r\nBenchmarkGoroutineWithFunc-4 \t 1\t3445631705 ns/op\r\nBenchmarkSemaphoreWithFunc-4 \t 1\t1037219073 ns/op\r\nBenchmarkAntsPoolWithFunc-4 \t 1\t1138053222 ns/op\r\nBenchmarkGoroutine-4 \t 2\t 731850771 ns/op\r\nBenchmarkSemaphore-4 \t 2\t 914855967 ns/op\r\nBenchmarkAntsPool-4 \t 1\t1094379445 ns/op\r\nPASS\r\nok \tgithub.com/panjf2000/ants\t33.173s\r\n```\r\n那 Ants 在什么情况下有优势呢?""",,,DONE,,0,2018-12-14T06:01:07.000+00:00,2018-12-08T10:08:17.000+00:00,2018-12-14T06:01:07.000+00:00,8392,,,0,0,0,github:GithubAccount:1:720086,huangjunwen,github:GithubAccount:1:0,,, +github:GithubIssue:1:401277739,https://github.com/panjf2000/ants/issues/22,,22,是否考虑 worker 中添加 PanicHandler ?,"""比方说在创建 Pool 的时候传入一个 PanicHandler,然后在每个 worker 创建的时候 recover 之后传给 PanicHandler 处理。否则池子里如果发生 panic 会直接挂掉整个进程。""",,,DONE,,0,2019-01-22T05:41:34.000+00:00,2019-01-21T10:06:56.000+00:00,2019-01-22T05:41:34.000+00:00,1174,,,0,0,0,github:GithubAccount:1:8923413,choleraehyq,github:GithubAccount:1:0,,, +github:GithubIssue:1:402513849,https://github.com/panjf2000/ants/issues/24,,24,提交任务不阻塞,"""`Pool.Submit`和`PoolWithFunc.Server`提交任务,如果没有空的worker,会一直阻塞。建议增加不阻塞的接口,当前失败时直接返回错误。""",,,DONE,,0,2019-08-20T10:56:30.000+00:00,2019-01-24T02:24:13.000+00:00,2019-08-20T10:56:30.000+00:00,300032,,,0,0,0,github:GithubAccount:1:5044825,tenfyzhong,github:GithubAccount:1:0,,, +github:GithubIssue:1:405951301,https://github.com/panjf2000/ants/issues/25,,25,use example errors,"""./antstest.go:37:14: cannot use syncCalculateSum (type func()) as type ants.f in argument to ants.Submit\r\n./antstest.go:45:35: cannot use func literal (type func(interface {})) as type ants.pf in argument to ants.NewPoolWithFunc\r\n""",,,DONE,,0,2019-02-04T09:11:52.000+00:00,2019-02-02T05:43:38.000+00:00,2019-02-04T09:11:52.000+00:00,3088,,,0,0,0,github:GithubAccount:1:5244267,jiashiwen,github:GithubAccount:1:0,,, +github:GithubIssue:1:413968505,https://github.com/panjf2000/ants/issues/26,,26,running可能大于cap的问题,"""running与cap的比较判断与incRuning分开执行的, 可能会出现running大于cap的问题?\r\n`func (p *Pool) retrieveWorker() *Worker {\r\n\tvar w *Worker\r\n\r\n\tp.lock.Lock()\r\n\tidleWorkers := p.workers\r\n\tn := len(idleWorkers) - 1\r\n\tif n >= 0 {\r\n\t\tw = idleWorkers[n]\r\n\t\tidleWorkers[n] = nil\r\n\t\tp.workers = idleWorkers[:n]\r\n\t\tp.lock.Unlock()\r\n\t} else if p.Running() < p.Cap() {\r\n\t\tp.lock.Unlock()\r\n\t\tif cacheWorker := p.workerCache.Get(); cacheWorker != nil {\r\n\t\t\tw = cacheWorker.(*Worker)\r\n\t\t} else {\r\n\t\t\tw = &Worker{\r\n\t\t\t\tpool: p,\r\n\t\t\t\ttask: make(chan func(), workerChanCap),\r\n\t\t\t}\r\n\t\t}\r\n\t\tw.run()`""",,,DONE,,0,2019-03-12T12:01:57.000+00:00,2019-02-25T07:29:33.000+00:00,2019-03-12T12:01:57.000+00:00,21872,,,0,0,0,github:GithubAccount:1:10361713,Ainiroad,github:GithubAccount:1:0,,, +github:GithubIssue:1:419183961,https://github.com/panjf2000/ants/issues/27,,27,为何goroutine一直上不去,用户量也打不上去,"""为何goroutine一直上不去,用户量也打不上去\r\n是我用的有问题吗?\r\n\r\nwebsocket server\r\nhttps://github.com/im-ai/pushm/blob/master/learn/goroutine/goroutinepoolwebsocket.go\r\n\r\nwebsocket cient\r\nhttps://github.com/im-ai/pushm/blob/master/learn/goroutine/goroutinepoolwebsocketclient.go\r\n""",,,DONE,,0,2019-04-05T14:05:20.000+00:00,2019-03-10T13:08:52.000+00:00,2019-04-05T14:05:20.000+00:00,37496,,,0,0,0,github:GithubAccount:1:38367404,liliang8858,github:GithubAccount:1:0,,, +github:GithubIssue:1:419268851,https://github.com/panjf2000/ants/issues/28,,28,cap 和 running 比较的问题,"""这是我在 Playground 上面的代码 https://play.golang.org/p/D94YUU3FnX6\r\natomic 只能保证自增自减时的原子操作,在比较过程中,其他线程对变量进行了操作 比较过程并无感知,所以这个比较结果 不是完全正确的,想要实现 比较的数量完全正确,只能在修改和比较两个值的地方加锁\r\n像 #26 说的是对的""",,,DONE,,0,2019-08-22T16:27:37.000+00:00,2019-03-11T02:24:41.000+00:00,2019-08-22T16:27:37.000+00:00,237002,,,0,0,0,github:GithubAccount:1:29243953,naiba,github:GithubAccount:1:0,,, +github:GithubIssue:1:424634533,https://github.com/panjf2000/ants/issues/29,,29,任务传参,"""你好,你的项目太酷了👍\r\n\r\nhttps://github.com/panjf2000/ants/blob/master/pool.go#L124 貌似不支持带参数的任务, 请问传参是用闭包的方式吗?\r\n""",,,DONE,,0,2019-03-25T09:32:11.000+00:00,2019-03-24T16:52:21.000+00:00,2019-03-25T09:45:05.000+00:00,999,,,0,0,0,github:GithubAccount:1:8509898,prprprus,github:GithubAccount:1:0,,, +github:GithubIssue:1:429972115,https://github.com/panjf2000/ants/issues/31,,31,Add go.mod,"""""",,,DONE,,0,2019-04-08T09:45:31.000+00:00,2019-04-05T23:50:36.000+00:00,2019-10-17T03:12:19.000+00:00,3474,,,0,0,0,github:GithubAccount:1:48135919,tsatke,github:GithubAccount:1:0,,, +github:GithubIssue:1:433564955,https://github.com/panjf2000/ants/issues/32,,32,关于版本问题,我发现小版本(0.0.x)这种更新就会不向下兼容?,"""如题,我感觉这样不好。\r\n\r\n功能版本号不向下兼容能理解\r\n\r\n修复问题的版本号也不向下兼容,难以理解。""",,,DONE,,0,2019-04-21T07:16:26.000+00:00,2019-04-16T03:16:02.000+00:00,2019-04-21T07:16:26.000+00:00,7440,,,0,0,0,github:GithubAccount:1:7931755,zplzpl,github:GithubAccount:1:0,,, +github:GithubIssue:1:434069015,https://github.com/panjf2000/ants/issues/33,,33,support semantic versioning.,"""建议将发布的tag兼容为semantic versioning,vX.Y.Z。go modules对此支持比较良好。\r\nhttps://semver.org/\r\nhttps://research.swtch.com/vgo-import""",,,DONE,,0,2019-04-21T08:25:20.000+00:00,2019-04-17T02:55:11.000+00:00,2019-04-21T08:25:20.000+00:00,6090,,,0,0,0,github:GithubAccount:1:1284892,jjeffcaii,github:GithubAccount:1:0,,, +github:GithubIssue:1:435486645,https://github.com/panjf2000/ants/issues/34,,34,Important announcement about from author !!!,"""**Dear users of `ants`:**\r\nI am apologetically telling you that I have to dump all tags which already presents in `ants` repository.\r\n\r\nThe reason why I'm doing so is to standardize the version management with `Semantic Versioning`, which will make a formal and clear dependency management in go, for go modules, godep, or glide, etc. So I decide to start over the tag sequence, you could find more details in [Semantic Versioning](https://semver.org/) and [Semantic Import Versioning](https://research.swtch.com/vgo-import), related issue: #32, #33 (very thankful to @jjeffcaii and @zplzpl who provided the suggestions about it).\r\n\r\nI ought to apologize for the bothers brought by this change, the arch-criminal who leads to this issue would be my lack of concept about `Semantic Versioning`, I will spend more times learning the knowledge afterwards. \r\n\r\nOnce again, sorry for your costs in this change and thanks for your support to `ants`! \r\n\r\n*Have fun!*\r\n\r\n**Best regards,\r\nAndy Pan**\r\n""",,,DONE,,0,2019-05-07T15:35:08.000+00:00,2019-04-21T08:10:28.000+00:00,2019-05-07T15:35:08.000+00:00,23484,,,0,0,0,github:GithubAccount:1:7496278,panjf2000,github:GithubAccount:1:0,,, +github:GithubIssue:1:461280653,https://github.com/panjf2000/ants/issues/35,,35,worker exit on panic,"""个人认为PanicHandler设计不妥。\r\n1.无PanicHandler时,抛出给外面的不是panic,外层感受不到。\r\n2.无论有没有PanicHandler,都会导致worker退出,最终pool阻塞住全部任务。""",,,DONE,,0,2019-08-17T20:33:10.000+00:00,2019-06-27T03:11:49.000+00:00,2019-08-17T20:33:10.000+00:00,74481,,,0,0,0,github:GithubAccount:1:38849208,king526,github:GithubAccount:1:0,,, +github:GithubIssue:1:462631417,https://github.com/panjf2000/ants/issues/37,,37,请不要再随意变更版本号了。。。,"""之前用的是 3.9.9,结果今天构建出了问题,一看发现这个版本没了,变成 1.0.0。这种变更完全不考虑现有用户的情况。希望以后不要随意变更了""",,,DONE,,0,2019-07-01T12:37:55.000+00:00,2019-07-01T10:17:15.000+00:00,2019-07-02T10:17:31.000+00:00,140,,,0,0,0,github:GithubAccount:1:8923413,choleraehyq,github:GithubAccount:1:0,,, +github:GithubIssue:1:472125082,https://github.com/panjf2000/ants/issues/38,,38,retrieveWorker与revertWorker之间会导致死锁,"""func (p *Pool) retrieveWorker() *Worker {\r\n\tvar w *Worker\r\n\r\n\t**p.lock.Lock()**\r\n\tidleWorkers := p.workers\r\n\tn := len(idleWorkers) - 1\r\n\tif n >= 0 {\r\n\t\tw = idleWorkers[n]\r\n\t\tidleWorkers[n] = nil\r\n\t\tp.workers = idleWorkers[:n]\r\n\t\tp.lock.Unlock()\r\n\t} else if p.Running() < p.Cap() {\r\n\t\tp.lock.Unlock()\r\n\t\tif cacheWorker := p.workerCache.Get(); cacheWorker != nil {\r\n\t\t\tw = cacheWorker.(*Worker)\r\n\t\t} else {\r\n\t\t\tw = &Worker{\r\n\t\t\t\tpool: p,\r\n\t\t\t\ttask: make(chan func(), workerChanCap),\r\n\t\t\t}\r\n\t\t}\r\n\t\tw.run()\r\n\t} else {\r\n\t\tfor {\r\n\t\t\t**p.cond.Wait()** \r\n\t\t\tl := len(p.workers) - 1\r\n\t\t\tif l < 0 {\r\n\t\t\t\tcontinue\r\n\t\t\t}\r\n\t\t\tw = p.workers[l]\r\n\t\t\tp.workers[l] = nil\r\n\t\t\tp.workers = p.workers[:l]\r\n\t\t\tbreak\r\n\t\t}\r\n\t\t**p.lock.Unlock()**\r\n\t}\r\n\treturn w\r\n}\r\n\r\n// revertWorker puts a worker back into free pool, recycling the goroutines.\r\nfunc (p *Pool) revertWorker(worker *Worker) bool {\r\n\tif CLOSED == atomic.LoadInt32(&p.release) {\r\n\t\treturn false\r\n\t}\r\n\tworker.recycleTime = time.Now()\r\n\t**p.lock.Lock()** // 协程池满了之后获取不到锁\r\n\tp.workers = append(p.workers, worker)\r\n\t// Notify the invoker stuck in 'retrieveWorker()' of there is an available worker in the worker queue.\r\n\tp.cond.Signal()\r\n\t**p.lock.Unlock()**\r\n\treturn true\r\n}\r\n""",,,DONE,,0,2019-07-24T08:40:01.000+00:00,2019-07-24T07:32:58.000+00:00,2019-07-24T08:40:01.000+00:00,67,,,0,0,0,github:GithubAccount:1:1290360,wwjiang,github:GithubAccount:1:0,,, +github:GithubIssue:1:483164833,https://github.com/panjf2000/ants/issues/42,,42,带选项的初始化函数,我觉得用 functional options 更好一点,"""以下是示意代码\r\n如果用 functional options,原来的写法是\r\n```\r\nants.NewPool(10)\r\n```\r\n新的写法,如果不加 option,写法是不变的,因为 options 是作为可变参数传进去的。如果要加 option,只需要改成\r\n```\r\nants.NewPool(10, ants.WithNonblocking(true))\r\n```\r\n这样。\r\n\r\n现在是直接传一个 Option 结构体进去,所有的地方都要改,感觉很不优雅。\r\n具体 functional options 的设计可以看 rob pike 的一篇博客 https://commandcenter.blogspot.com/2014/01/self-referential-functions-and-design.html""",,,DONE,,0,2019-08-21T14:32:51.000+00:00,2019-08-21T02:20:08.000+00:00,2019-08-21T14:32:51.000+00:00,732,,,0,0,0,github:GithubAccount:1:8923413,choleraehyq,github:GithubAccount:1:0,,, +github:GithubIssue:1:483736247,https://github.com/panjf2000/ants/issues/43,,43,1.3.0 是不兼容更新,"""Pool 里那些暴露出来的字段(PanicHandler 之类的)都没了,这是一个不兼容更新,根据语义化版本的要求要发大版本。""",,,DONE,,0,2019-08-22T13:22:10.000+00:00,2019-08-22T02:29:34.000+00:00,2019-08-22T13:22:10.000+00:00,652,,,0,0,0,github:GithubAccount:1:8923413,choleraehyq,github:GithubAccount:1:0,,, +github:GithubIssue:1:484311063,https://github.com/panjf2000/ants/issues/44,,44,1.1.1 -> 1.2.0 也是不兼容更新,"""Pool.Release 的返回值没了""",,,DONE,,0,2019-08-25T06:36:14.000+00:00,2019-08-23T03:27:38.000+00:00,2019-08-25T06:36:14.000+00:00,3068,,,0,0,0,github:GithubAccount:1:8923413,choleraehyq,github:GithubAccount:1:0,,, diff --git a/plugins/github/e2e/snapshot_tables/pull_request_comments.csv b/plugins/github/e2e/snapshot_tables/pull_request_comments.csv index 6358fd6fec0..9ed31a62a66 100644 --- a/plugins/github/e2e/snapshot_tables/pull_request_comments.csv +++ b/plugins/github/e2e/snapshot_tables/pull_request_comments.csv @@ -1,47 +1,47 @@ id,pull_request_id,body,user_id,created_date,commit_sha,position -github:GithubPullRequest:1:407675431,github:GithubPullRequest:1:203756736,"""# [Codecov](https://codecov.io/gh/panjf2000/ants/pull/4?src=pr&el=h1) Report\n> Merging [#4](https://codecov.io/gh/panjf2000/ants/pull/4?src=pr&el=desc) into [master](https://codecov.io/gh/panjf2000/ants/commit/f5b37d0798a8e4c6780a1e08270fa50e979aa1d7?src=pr&el=desc) will **not change** coverage.\n> The diff coverage is `100%`.\n\n[![Impacted file tree graph](https://codecov.io/gh/panjf2000/ants/pull/4/graphs/tree.svg?token=JFa3laaGKq&width=650&height=150&src=pr)](https://codecov.io/gh/panjf2000/ants/pull/4?src=pr&el=tree)\n\n```diff\n@@ Coverage Diff @@\n## master #4 +/- ##\n=====================================\n Coverage 100% 100% \n=====================================\n Files 5 5 \n Lines 237 241 +4 \n=====================================\n+ Hits 237 241 +4\n```\n\n\n| [Impacted Files](https://codecov.io/gh/panjf2000/ants/pull/4?src=pr&el=tree) | Coverage Δ | |\n|---|---|---|\n| [worker.go](https://codecov.io/gh/panjf2000/ants/pull/4/diff?src=pr&el=tree#diff-d29ya2VyLmdv) | `100% <100%> (ø)` | :arrow_up: |\n| [worker\\_func.go](https://codecov.io/gh/panjf2000/ants/pull/4/diff?src=pr&el=tree#diff-d29ya2VyX2Z1bmMuZ28=) | `100% <100%> (ø)` | :arrow_up: |\n| [pool\\_func.go](https://codecov.io/gh/panjf2000/ants/pull/4/diff?src=pr&el=tree#diff-cG9vbF9mdW5jLmdv) | `100% <100%> (ø)` | :arrow_up: |\n| [pool.go](https://codecov.io/gh/panjf2000/ants/pull/4/diff?src=pr&el=tree#diff-cG9vbC5nbw==) | `100% <100%> (ø)` | :arrow_up: |\n\n------\n\n[Continue to review full report at Codecov](https://codecov.io/gh/panjf2000/ants/pull/4?src=pr&el=continue).\n> **Legend** - [Click here to learn more](https://docs.codecov.io/docs/codecov-delta)\n> `Δ = absolute (impact)`, `ø = not affected`, `? = missing data`\n> Powered by [Codecov](https://codecov.io/gh/panjf2000/ants/pull/4?src=pr&el=footer). Last update [f5b37d0...83042d7](https://codecov.io/gh/panjf2000/ants/pull/4?src=pr&el=lastupdated). Read the [comment docs](https://docs.codecov.io/docs/pull-request-comments).\n""",github:GithubUser:1:22429695,2018-07-25T08:25:22.000+00:00,,0 -github:GithubPullRequest:1:407714136,github:GithubPullRequest:1:203756736,"""@barryz 改的不错,不过有一点需要商榷,那个预分配的大小,之前benchmark我记得1000w也只需要用到7w多,这样的话预分配5w对于大部分场景其实有点浪费,你有没有用修改后的代码benchmark一下,每次allocs/op应该是变大了吧""",github:GithubUser:1:7496278,2018-07-25T10:49:44.000+00:00,,0 -github:GithubPullRequest:1:407755528,github:GithubPullRequest:1:203756736,"""@panjf2000 因为从压测结果来看, 1000W的场景下goroutine池的作用很明显, 尤其是在节省内存开销方面,所以在选择默认worker数量时,取了一个相对较大的值。 下面是benchmark 对比\r\n\r\nmaster:\r\n\r\n```\r\ngoos: linux\r\ngoarch: amd64\r\nBenchmarkGoroutineWithFunc-4 1 15079030287 ns/op 723120296 B/op 10176159 allocs/op\r\nPASS\r\nok command-line-arguments 15.106s\r\n```\r\n\r\nPR:\r\n```\r\ngoos: linux\r\ngoarch: amd64\r\nBenchmarkGoroutineWithFunc-4 1 15443376244 ns/op 720962888 B/op 10167850 allocs/op\r\nPASS\r\nok command-line-arguments 15.479s\r\n```\r\n""",github:GithubUser:1:16658738,2018-07-25T13:33:42.000+00:00,,0 -github:GithubPullRequest:1:407764945,github:GithubPullRequest:1:203756736,"""@barryz 这样看起来预分配似乎没有太大的内存优势,相反在其他数量的任务量场景下可能还会有点浪费,这样吧,要不你先把预分配内存这一块的暂时移除,然后我合一下优化代码的部分,至于预分配内存这一块,后续再继续讨论下看看有没有能兼顾的办法""",github:GithubUser:1:7496278,2018-07-25T14:02:41.000+00:00,,0 -github:GithubPullRequest:1:416794440,github:GithubPullRequest:1:211603583,"""@hongli-my 不好意思,我没太懂你的意图?能麻烦说详细点吗?""",github:GithubUser:1:7496278,2018-08-29T01:39:23.000+00:00,,0 -github:GithubPullRequest:1:416794871,github:GithubPullRequest:1:211603583,"""# [Codecov](https://codecov.io/gh/panjf2000/ants/pull/8?src=pr&el=h1) Report\n> Merging [#8](https://codecov.io/gh/panjf2000/ants/pull/8?src=pr&el=desc) into [master](https://codecov.io/gh/panjf2000/ants/commit/666635c65d8d3bb1223b819325e0bd23c81f2733?src=pr&el=desc) will **decrease** coverage by `1.24%`.\n> The diff coverage is `100%`.\n\n[![Impacted file tree graph](https://codecov.io/gh/panjf2000/ants/pull/8/graphs/tree.svg?width=650&token=JFa3laaGKq&height=150&src=pr)](https://codecov.io/gh/panjf2000/ants/pull/8?src=pr&el=tree)\n\n```diff\n@@ Coverage Diff @@\n## master #8 +/- ##\n==========================================\n- Coverage 100% 98.75% -1.25% \n==========================================\n Files 5 5 \n Lines 241 241 \n==========================================\n- Hits 241 238 -3 \n- Misses 0 2 +2 \n- Partials 0 1 +1\n```\n\n\n| [Impacted Files](https://codecov.io/gh/panjf2000/ants/pull/8?src=pr&el=tree) | Coverage Δ | |\n|---|---|---|\n| [pool\\_func.go](https://codecov.io/gh/panjf2000/ants/pull/8/diff?src=pr&el=tree#diff-cG9vbF9mdW5jLmdv) | `100% <100%> (ø)` | :arrow_up: |\n| [pool.go](https://codecov.io/gh/panjf2000/ants/pull/8/diff?src=pr&el=tree#diff-cG9vbC5nbw==) | `97.19% <0%> (-2.81%)` | :arrow_down: |\n\n------\n\n[Continue to review full report at Codecov](https://codecov.io/gh/panjf2000/ants/pull/8?src=pr&el=continue).\n> **Legend** - [Click here to learn more](https://docs.codecov.io/docs/codecov-delta)\n> `Δ = absolute (impact)`, `ø = not affected`, `? = missing data`\n> Powered by [Codecov](https://codecov.io/gh/panjf2000/ants/pull/8?src=pr&el=footer). Last update [666635c...afd6871](https://codecov.io/gh/panjf2000/ants/pull/8?src=pr&el=lastupdated). Read the [comment docs](https://docs.codecov.io/docs/pull-request-comments).\n""",github:GithubUser:1:22429695,2018-08-29T01:42:05.000+00:00,,0 -github:GithubPullRequest:1:416803651,github:GithubPullRequest:1:211603583,"""```n := 0\r\n\t\tfor i, w := range idleWorkers {\r\n\t\t\tif currentTime.Sub(w.recycleTime) <= p.expiryDuration {\r\n\t\t\t\tbreak\r\n\t\t\t}\r\n\t\t\tn = i\r\n\t\t\tw.args <- nil\r\n\t\t\tidleWorkers[i] = nil\r\n\t\t}\r\n\t\tn++\r\n\t\tif n >= len(idleWorkers) {\r\n\t\t\tp.workers = idleWorkers[:0]\r\n\t\t} else {\r\n\t\t\tp.workers = idleWorkers[n:]\r\n\t\t}```\r\nfor 循环中,如果for 循环没有满足条件,n 并没有复制,此时n ++, n 变为1, p.workers = idleWorkers[1:], idleWorkers[0] 丢弃了? 但是并没有w.args <- nil 操作""",github:GithubUser:1:8597823,2018-08-29T02:34:07.000+00:00,,0 -github:GithubPullRequest:1:416818094,github:GithubPullRequest:1:211603583,"""@hongli-my 嗯,我知道了,但是你的修改似乎不完整,我已经在develop分支改了一版,要不你看下那个分支,然后按照那个再改一下,然后我再merge""",github:GithubUser:1:7496278,2018-08-29T04:11:17.000+00:00,,0 -github:GithubPullRequest:1:421884048,github:GithubPullRequest:1:211603583,"""对于worker中的chan应该也需要close吧,当协程数量增大时,这种也是一种消耗""",github:GithubUser:1:29241786,2018-09-17T03:37:44.000+00:00,,0 -github:GithubPullRequest:1:425423544,github:GithubPullRequest:1:218939809,"""@liyonglion 我看修改的代码应该是正确的,但是有两个问题:\r\n1. 要正确测试你pr,你要把ants_test.go里import ants的路径改成你自己的路径;\r\n2. 你现在只修改了pool.go的代码,麻烦把pool_func.go里相应的地方也优化一下。\r\n\r\n你重新修改一下pr,然后通过测试,我就merge了。""",github:GithubUser:1:7496278,2018-09-28T12:43:30.000+00:00,,0 -github:GithubPullRequest:1:425428914,github:GithubPullRequest:1:218939809,"""我又仔细地想了想,在putWorker方法中,调用p.cond.Signal()之前,p.lock已经解锁了,如果这时候被\r\n![image](https://user-images.githubusercontent.com/7496278/46209831-824b0a00-c361-11e8-9109-609d21bab572.png)\r\n这里获得锁,则空闲队列中的刚刚放入的worker会被取出,这时候p.cond.Wait()再获得锁去队列中取worker的时候就会取不到,len(p.workers) - 1就会是-1,会报错:index out of range,和https://github.com/panjf2000/ants/issues/6 相似的问题,所以p.cond.Signal()应该放在putWorker中的p.lock.Lock()和p.lock.Unlock()之间。\r\n""",github:GithubUser:1:7496278,2018-09-28T13:03:48.000+00:00,,0 -github:GithubPullRequest:1:425431081,github:GithubPullRequest:1:218939809,"""我明天仔细研究下。如果这个地方的死锁不好解决,其实可以使用另外一把锁,专门给条件变量使用。""",github:GithubUser:1:12890888,2018-09-28T13:12:08.000+00:00,,0 -github:GithubPullRequest:1:425432498,github:GithubPullRequest:1:218939809,"""单一操作变量最好不要有多个锁,这样引发死锁的概率会非常高。""",github:GithubUser:1:7496278,2018-09-28T13:17:44.000+00:00,,0 -github:GithubPullRequest:1:425438107,github:GithubPullRequest:1:218939809,"""新的锁只给条件变量使用,其他任何地方都不会使用。如果怕死锁,明天我封装一层,pool层只有一把锁。""",github:GithubUser:1:12890888,2018-09-28T13:37:48.000+00:00,,0 -github:GithubPullRequest:1:425439137,github:GithubPullRequest:1:218939809,"""封装一层后,按照你的思路修改应该就可以了。""",github:GithubUser:1:12890888,2018-09-28T13:41:20.000+00:00,,0 -github:GithubPullRequest:1:425608265,github:GithubPullRequest:1:218939809,"""看了下代码,你说的没错。我在测试下性能方面""",github:GithubUser:1:12890888,2018-09-29T02:22:39.000+00:00,,0 -github:GithubPullRequest:1:425609411,github:GithubPullRequest:1:218939809,"""![image](https://user-images.githubusercontent.com/7496278/46240052-34bbb500-c3d4-11e8-809b-46b429039aee.png)\r\n你这改的有问题,取出来后没有对workers队列缩容,现在Travis CI整个卡住了""",github:GithubUser:1:7496278,2018-09-29T02:41:56.000+00:00,,0 -github:GithubPullRequest:1:425609608,github:GithubPullRequest:1:218939809,"""嗯,到时候我会补上。容我再想想""",github:GithubUser:1:12890888,2018-09-29T02:45:23.000+00:00,,0 -github:GithubPullRequest:1:425622339,github:GithubPullRequest:1:218939809,"""性能测试如下:\r\n100w的并发,5w的goroutine\r\n![snip20180929_3](https://user-images.githubusercontent.com/12890888/46242225-93932580-c3f8-11e8-841c-fc7fc620313d.png)\r\n\r\n![snip20180929_5](https://user-images.githubusercontent.com/12890888/46242227-9beb6080-c3f8-11e8-80fa-5d01da9aba19.png)\r\n""",github:GithubUser:1:12890888,2018-09-29T07:02:56.000+00:00,,0 -github:GithubPullRequest:1:425622437,github:GithubPullRequest:1:218939809,"""# [Codecov](https://codecov.io/gh/panjf2000/ants/pull/13?src=pr&el=h1) Report\n> Merging [#13](https://codecov.io/gh/panjf2000/ants/pull/13?src=pr&el=desc) into [master](https://codecov.io/gh/panjf2000/ants/commit/af376f1b7b59dc488458bcecd4273f0fcde33c55?src=pr&el=desc) will **decrease** coverage by `90.38%`.\n> The diff coverage is `5%`.\n\n[![Impacted file tree graph](https://codecov.io/gh/panjf2000/ants/pull/13/graphs/tree.svg?width=650&token=JFa3laaGKq&height=150&src=pr)](https://codecov.io/gh/panjf2000/ants/pull/13?src=pr&el=tree)\n\n```diff\n@@ Coverage Diff @@\n## master #13 +/- ##\n==========================================\n- Coverage 98.75% 8.36% -90.39% \n==========================================\n Files 5 5 \n Lines 241 239 -2 \n==========================================\n- Hits 238 20 -218 \n- Misses 1 214 +213 \n- Partials 2 5 +3\n```\n\n\n| [Impacted Files](https://codecov.io/gh/panjf2000/ants/pull/13?src=pr&el=tree) | Coverage Δ | |\n|---|---|---|\n| [pool\\_func.go](https://codecov.io/gh/panjf2000/ants/pull/13/diff?src=pr&el=tree#diff-cG9vbF9mdW5jLmdv) | `0% <0%> (-97.23%)` | :arrow_down: |\n| [pool.go](https://codecov.io/gh/panjf2000/ants/pull/13/diff?src=pr&el=tree#diff-cG9vbC5nbw==) | `18.86% <10%> (-81.14%)` | :arrow_down: |\n| [worker\\_func.go](https://codecov.io/gh/panjf2000/ants/pull/13/diff?src=pr&el=tree#diff-d29ya2VyX2Z1bmMuZ28=) | `0% <0%> (-100%)` | :arrow_down: |\n| [worker.go](https://codecov.io/gh/panjf2000/ants/pull/13/diff?src=pr&el=tree#diff-d29ya2VyLmdv) | `0% <0%> (-100%)` | :arrow_down: |\n| [ants.go](https://codecov.io/gh/panjf2000/ants/pull/13/diff?src=pr&el=tree#diff-YW50cy5nbw==) | `0% <0%> (-100%)` | :arrow_down: |\n\n------\n\n[Continue to review full report at Codecov](https://codecov.io/gh/panjf2000/ants/pull/13?src=pr&el=continue).\n> **Legend** - [Click here to learn more](https://docs.codecov.io/docs/codecov-delta)\n> `Δ = absolute (impact)`, `ø = not affected`, `? = missing data`\n> Powered by [Codecov](https://codecov.io/gh/panjf2000/ants/pull/13?src=pr&el=footer). Last update [af376f1...1846b43](https://codecov.io/gh/panjf2000/ants/pull/13?src=pr&el=lastupdated). Read the [comment docs](https://docs.codecov.io/docs/pull-request-comments).\n""",github:GithubUser:1:22429695,2018-09-29T07:05:01.000+00:00,,0 -github:GithubPullRequest:1:425623081,github:GithubPullRequest:1:218939809,"""@panjf2000 这个覆盖率怎么看?""",github:GithubUser:1:12890888,2018-09-29T07:16:02.000+00:00,,0 -github:GithubPullRequest:1:425632550,github:GithubPullRequest:1:218939809,"""怎么会有负数。。。""",github:GithubUser:1:7496278,2018-09-29T09:53:47.000+00:00,,0 -github:GithubPullRequest:1:425632613,github:GithubPullRequest:1:218939809,"""而且你那个取出worker之后还是没有对队列进行缩容吧""",github:GithubUser:1:7496278,2018-09-29T09:54:48.000+00:00,,0 -github:GithubPullRequest:1:425632632,github:GithubPullRequest:1:218939809,"""这个我没玩过。。。。""",github:GithubUser:1:12890888,2018-09-29T09:55:07.000+00:00,,0 -github:GithubPullRequest:1:425632777,github:GithubPullRequest:1:218939809,"""@panjf2000 我缩容了,具体哪个地方?""",github:GithubUser:1:12890888,2018-09-29T09:57:34.000+00:00,,0 -github:GithubPullRequest:1:425637776,github:GithubPullRequest:1:218939809,"""@liyonglion 我看错了,缩容的补上了,这块没什么问题了,关于覆盖率这块我明天再查查。。。""",github:GithubUser:1:7496278,2018-09-29T11:25:56.000+00:00,,0 -github:GithubPullRequest:1:425637938,github:GithubPullRequest:1:218939809,"""哦,我知道了,应该是那个import路径的问题导致的,那我先merge一下代码""",github:GithubUser:1:7496278,2018-09-29T11:29:28.000+00:00,,0 -github:GithubPullRequest:1:425896318,github:GithubPullRequest:1:219363161,"""# [Codecov](https://codecov.io/gh/panjf2000/ants/pull/14?src=pr&el=h1) Report\n> Merging [#14](https://codecov.io/gh/panjf2000/ants/pull/14?src=pr&el=desc) into [master](https://codecov.io/gh/panjf2000/ants/commit/1b62696050b7030106291980d5220f886b017eff?src=pr&el=desc) will **decrease** coverage by `2.12%`.\n> The diff coverage is `100%`.\n\n[![Impacted file tree graph](https://codecov.io/gh/panjf2000/ants/pull/14/graphs/tree.svg?width=650&token=JFa3laaGKq&height=150&src=pr)](https://codecov.io/gh/panjf2000/ants/pull/14?src=pr&el=tree)\n\n```diff\n@@ Coverage Diff @@\n## master #14 +/- ##\n=========================================\n- Coverage 98.32% 96.2% -2.13% \n=========================================\n Files 5 5 \n Lines 239 237 -2 \n=========================================\n- Hits 235 228 -7 \n- Misses 2 4 +2 \n- Partials 2 5 +3\n```\n\n\n| [Impacted Files](https://codecov.io/gh/panjf2000/ants/pull/14?src=pr&el=tree) | Coverage Δ | |\n|---|---|---|\n| [pool.go](https://codecov.io/gh/panjf2000/ants/pull/14/diff?src=pr&el=tree#diff-cG9vbC5nbw==) | `96.19% <100%> (-1.93%)` | :arrow_down: |\n| [pool\\_func.go](https://codecov.io/gh/panjf2000/ants/pull/14/diff?src=pr&el=tree#diff-cG9vbF9mdW5jLmdv) | `95.28% <100%> (-2.85%)` | :arrow_down: |\n\n------\n\n[Continue to review full report at Codecov](https://codecov.io/gh/panjf2000/ants/pull/14?src=pr&el=continue).\n> **Legend** - [Click here to learn more](https://docs.codecov.io/docs/codecov-delta)\n> `Δ = absolute (impact)`, `ø = not affected`, `? = missing data`\n> Powered by [Codecov](https://codecov.io/gh/panjf2000/ants/pull/14?src=pr&el=footer). Last update [1b62696...5ed1687](https://codecov.io/gh/panjf2000/ants/pull/14?src=pr&el=lastupdated). Read the [comment docs](https://docs.codecov.io/docs/pull-request-comments).\n""",github:GithubUser:1:22429695,2018-10-01T12:53:39.000+00:00,,0 -github:GithubPullRequest:1:425906970,github:GithubPullRequest:1:219363161,"""thanks for your correction and could you also modify the pool_func.go cuz there is also the same useless statement in that file. i will accept this pr after your modification is done, thanks.""",github:GithubUser:1:7496278,2018-10-01T13:27:04.000+00:00,,0 -github:GithubPullRequest:1:426537013,github:GithubPullRequest:1:219936521,"""# [Codecov](https://codecov.io/gh/panjf2000/ants/pull/15?src=pr&el=h1) Report\n> Merging [#15](https://codecov.io/gh/panjf2000/ants/pull/15?src=pr&el=desc) into [master](https://codecov.io/gh/panjf2000/ants/commit/29730bb70343924a2f56a13a9799611dd1cd27fd?src=pr&el=desc) will **decrease** coverage by `0.84%`.\n> The diff coverage is `n/a`.\n\n[![Impacted file tree graph](https://codecov.io/gh/panjf2000/ants/pull/15/graphs/tree.svg?width=650&token=JFa3laaGKq&height=150&src=pr)](https://codecov.io/gh/panjf2000/ants/pull/15?src=pr&el=tree)\n\n```diff\n@@ Coverage Diff @@\n## master #15 +/- ##\n=========================================\n- Coverage 97.04% 96.2% -0.85% \n=========================================\n Files 5 5 \n Lines 237 237 \n=========================================\n- Hits 230 228 -2 \n- Misses 3 4 +1 \n- Partials 4 5 +1\n```\n\n\n| [Impacted Files](https://codecov.io/gh/panjf2000/ants/pull/15?src=pr&el=tree) | Coverage Δ | |\n|---|---|---|\n| [pool.go](https://codecov.io/gh/panjf2000/ants/pull/15/diff?src=pr&el=tree#diff-cG9vbC5nbw==) | `96.19% <0%> (-1.91%)` | :arrow_down: |\n\n------\n\n[Continue to review full report at Codecov](https://codecov.io/gh/panjf2000/ants/pull/15?src=pr&el=continue).\n> **Legend** - [Click here to learn more](https://docs.codecov.io/docs/codecov-delta)\n> `Δ = absolute (impact)`, `ø = not affected`, `? = missing data`\n> Powered by [Codecov](https://codecov.io/gh/panjf2000/ants/pull/15?src=pr&el=footer). Last update [29730bb...3070771](https://codecov.io/gh/panjf2000/ants/pull/15?src=pr&el=lastupdated). Read the [comment docs](https://docs.codecov.io/docs/pull-request-comments).\n""",github:GithubUser:1:22429695,2018-10-03T07:23:08.000+00:00,,0 -github:GithubPullRequest:1:426596957,github:GithubPullRequest:1:219936521,"""@egonelbre thanks for your interest in this repository and i got some puzzles.\r\nfirstly, i don't understand why you use both the chan struct{} and sync.WaitGroup at once, that seems a bit excessive cuz waitgroup and chan did the same thing.\r\nsecondly, method BenchmarkGoroutine was design to test throughput so it should run without waitgroup.""",github:GithubUser:1:7496278,2018-10-03T11:05:45.000+00:00,,0 -github:GithubPullRequest:1:426604764,github:GithubPullRequest:1:219936521,"""Hi, semaphore acts as protection to avoid starting too many goroutines at once. `WaitGroup` is used to wait for everything to complete.\r\n\r\n`BenchmarkGoroutine` doesn't wait for all the goroutines to finish, so you are testing goroutine startup speed rather than throughput. It's somewhat unclear what you mean by \""throughput\"" in this case, but either way you would need to wait for all goroutines to finish, otherwise they will start affecting all other benchmarks. If you do want to benchmark goroutine startup speed, then you would need to add `b.StopTimer` before `wg.Wait`.""",github:GithubUser:1:192964,2018-10-03T11:37:48.000+00:00,,0 -github:GithubPullRequest:1:429609579,github:GithubPullRequest:1:222703171,"""# [Codecov](https://codecov.io/gh/panjf2000/ants/pull/16?src=pr&el=h1) Report\n> Merging [#16](https://codecov.io/gh/panjf2000/ants/pull/16?src=pr&el=desc) into [master](https://codecov.io/gh/panjf2000/ants/commit/711dbdb7a222771ce15aaee1bb7b7c6e9731f208?src=pr&el=desc) will **decrease** coverage by `2.03%`.\n> The diff coverage is `0%`.\n\n[![Impacted file tree graph](https://codecov.io/gh/panjf2000/ants/pull/16/graphs/tree.svg?width=650&token=JFa3laaGKq&height=150&src=pr)](https://codecov.io/gh/panjf2000/ants/pull/16?src=pr&el=tree)\n\n```diff\n@@ Coverage Diff @@\n## master #16 +/- ##\n==========================================\n- Coverage 97.46% 95.43% -2.04% \n==========================================\n Files 5 5 \n Lines 237 241 +4 \n==========================================\n- Hits 231 230 -1 \n- Misses 3 5 +2 \n- Partials 3 6 +3\n```\n\n\n| [Impacted Files](https://codecov.io/gh/panjf2000/ants/pull/16?src=pr&el=tree) | Coverage Δ | |\n|---|---|---|\n| [pool.go](https://codecov.io/gh/panjf2000/ants/pull/16/diff?src=pr&el=tree#diff-cG9vbC5nbw==) | `94.39% <0%> (-1.8%)` | :arrow_down: |\n| [pool\\_func.go](https://codecov.io/gh/panjf2000/ants/pull/16/diff?src=pr&el=tree#diff-cG9vbF9mdW5jLmdv) | `95.37% <0%> (-2.75%)` | :arrow_down: |\n\n------\n\n[Continue to review full report at Codecov](https://codecov.io/gh/panjf2000/ants/pull/16?src=pr&el=continue).\n> **Legend** - [Click here to learn more](https://docs.codecov.io/docs/codecov-delta)\n> `Δ = absolute (impact)`, `ø = not affected`, `? = missing data`\n> Powered by [Codecov](https://codecov.io/gh/panjf2000/ants/pull/16?src=pr&el=footer). Last update [711dbdb...439348b](https://codecov.io/gh/panjf2000/ants/pull/16?src=pr&el=lastupdated). Read the [comment docs](https://docs.codecov.io/docs/pull-request-comments).\n""",github:GithubUser:1:22429695,2018-10-14T09:24:39.000+00:00,,0 -github:GithubPullRequest:1:433821356,github:GithubPullRequest:1:211603583,"""这种bugfix是不是应该赶紧修了?""",github:GithubUser:1:8923413,2018-10-29T08:10:59.000+00:00,,0 -github:GithubPullRequest:1:434126048,github:GithubPullRequest:1:211603583,"""@choleraehyq 这个很早就已经修复了这个pr一直忘了关。""",github:GithubUser:1:7496278,2018-10-30T00:10:32.000+00:00,,0 -github:GithubPullRequest:1:434126349,github:GithubPullRequest:1:211603583,"""@MrDragon1122 一般来说channel是不需要显式close的,只要没有goroutine持有channel,相关资源会自动释放。""",github:GithubUser:1:7496278,2018-10-30T00:12:13.000+00:00,,0 -github:GithubPullRequest:1:439758381,github:GithubPullRequest:1:231840723,"""# [Codecov](https://codecov.io/gh/panjf2000/ants/pull/19?src=pr&el=h1) Report\n> Merging [#19](https://codecov.io/gh/panjf2000/ants/pull/19?src=pr&el=desc) into [develop](https://codecov.io/gh/panjf2000/ants/commit/92acf74bb71c1dc1758c61346c88325284978b3e?src=pr&el=desc) will **increase** coverage by `0.02%`.\n> The diff coverage is `100%`.\n\n[![Impacted file tree graph](https://codecov.io/gh/panjf2000/ants/pull/19/graphs/tree.svg?width=650&token=JFa3laaGKq&height=150&src=pr)](https://codecov.io/gh/panjf2000/ants/pull/19?src=pr&el=tree)\n\n```diff\n@@ Coverage Diff @@\n## develop #19 +/- ##\n===========================================\n+ Coverage 97.46% 97.48% +0.02% \n===========================================\n Files 5 5 \n Lines 237 239 +2 \n===========================================\n+ Hits 231 233 +2 \n Misses 3 3 \n Partials 3 3\n```\n\n\n| [Impacted Files](https://codecov.io/gh/panjf2000/ants/pull/19?src=pr&el=tree) | Coverage Δ | |\n|---|---|---|\n| [pool.go](https://codecov.io/gh/panjf2000/ants/pull/19/diff?src=pr&el=tree#diff-cG9vbC5nbw==) | `96.22% <100%> (+0.03%)` | :arrow_up: |\n| [pool\\_func.go](https://codecov.io/gh/panjf2000/ants/pull/19/diff?src=pr&el=tree#diff-cG9vbF9mdW5jLmdv) | `98.13% <100%> (+0.01%)` | :arrow_up: |\n\n------\n\n[Continue to review full report at Codecov](https://codecov.io/gh/panjf2000/ants/pull/19?src=pr&el=continue).\n> **Legend** - [Click here to learn more](https://docs.codecov.io/docs/codecov-delta)\n> `Δ = absolute (impact)`, `ø = not affected`, `? = missing data`\n> Powered by [Codecov](https://codecov.io/gh/panjf2000/ants/pull/19?src=pr&el=footer). Last update [92acf74...e7bacd0](https://codecov.io/gh/panjf2000/ants/pull/19?src=pr&el=lastupdated). Read the [comment docs](https://docs.codecov.io/docs/pull-request-comments).\n""",github:GithubUser:1:22429695,2018-11-19T03:06:06.000+00:00,,0 -github:GithubPullRequest:1:439758480,github:GithubPullRequest:1:231840723,"""我自己写了测试示例\r\n重复\r\nants.NewPoolWithFunc()\r\n然后\r\n进行Resize(0) && Release\r\n但仍发现内存泄漏现象,追溯到了NewTicker没有进行Stop可能导致\r\n\r\nflat flat% sum% cum cum%\r\n\r\n 7168.57kB 77.60% 77.60% 7168.57kB 77.60% time.NewTicker\r\n\r\n\r\n\r\n""",github:GithubUser:1:7931755,2018-11-19T03:06:50.000+00:00,,0 -github:GithubPullRequest:1:439781607,github:GithubPullRequest:1:231840723,"""突然看到一个PR有更完善的解决方式,不知道为啥没有PR成功""",github:GithubUser:1:7931755,2018-11-19T06:07:43.000+00:00,,0 -github:GithubPullRequest:1:439793352,github:GithubPullRequest:1:231840723,"""另外一个pr跟你大概是完成类似的功能,不过那个failed之后作者就没再更新了,所以就没有merge,你要是有时间不如参考下他的代码再优化下?就放到这个pr里。""",github:GithubUser:1:7496278,2018-11-19T07:14:58.000+00:00,,0 -github:GithubPullRequest:1:456033956,github:GithubPullRequest:1:246250598,"""# [Codecov](https://codecov.io/gh/panjf2000/ants/pull/23?src=pr&el=h1) Report\n> Merging [#23](https://codecov.io/gh/panjf2000/ants/pull/23?src=pr&el=desc) into [master](https://codecov.io/gh/panjf2000/ants/commit/812dd4e01075be3cf97429a43abaf6837908cdcd?src=pr&el=desc) will **decrease** coverage by `1.02%`.\n> The diff coverage is `71.42%`.\n\n[![Impacted file tree graph](https://codecov.io/gh/panjf2000/ants/pull/23/graphs/tree.svg?width=650&token=JFa3laaGKq&height=150&src=pr)](https://codecov.io/gh/panjf2000/ants/pull/23?src=pr&el=tree)\n\n```diff\n@@ Coverage Diff @@\n## master #23 +/- ##\n==========================================\n- Coverage 97.07% 96.04% -1.03% \n==========================================\n Files 5 5 \n Lines 239 253 +14 \n==========================================\n+ Hits 232 243 +11 \n- Misses 3 5 +2 \n- Partials 4 5 +1\n```\n\n\n| [Impacted Files](https://codecov.io/gh/panjf2000/ants/pull/23?src=pr&el=tree) | Coverage Δ | |\n|---|---|---|\n| [pool\\_func.go](https://codecov.io/gh/panjf2000/ants/pull/23/diff?src=pr&el=tree#diff-cG9vbF9mdW5jLmdv) | `98.13% <ø> (+2.8%)` | :arrow_up: |\n| [pool.go](https://codecov.io/gh/panjf2000/ants/pull/23/diff?src=pr&el=tree#diff-cG9vbC5nbw==) | `96.22% <ø> (-1.89%)` | :arrow_down: |\n| [worker\\_func.go](https://codecov.io/gh/panjf2000/ants/pull/23/diff?src=pr&el=tree#diff-d29ya2VyX2Z1bmMuZ28=) | `86.66% <71.42%> (-13.34%)` | :arrow_down: |\n| [worker.go](https://codecov.io/gh/panjf2000/ants/pull/23/diff?src=pr&el=tree#diff-d29ya2VyLmdv) | `86.66% <71.42%> (-13.34%)` | :arrow_down: |\n\n------\n\n[Continue to review full report at Codecov](https://codecov.io/gh/panjf2000/ants/pull/23?src=pr&el=continue).\n> **Legend** - [Click here to learn more](https://docs.codecov.io/docs/codecov-delta)\n> `Δ = absolute (impact)`, `ø = not affected`, `? = missing data`\n> Powered by [Codecov](https://codecov.io/gh/panjf2000/ants/pull/23?src=pr&el=footer). Last update [812dd4e...5bbc9e1](https://codecov.io/gh/panjf2000/ants/pull/23?src=pr&el=lastupdated). Read the [comment docs](https://docs.codecov.io/docs/pull-request-comments).\n""",github:GithubUser:1:22429695,2019-01-21T11:00:28.000+00:00,,0 -github:GithubPullRequest:1:456071084,github:GithubPullRequest:1:246250598,"""@choleraehyq \r\nbuild失败了,解决一下?""",github:GithubUser:1:7496278,2019-01-21T13:18:19.000+00:00,,0 -github:GithubPullRequest:1:456261758,github:GithubPullRequest:1:246250598,"""@panjf2000 这是测试覆盖率的问题吧,我已经测了设置 PanicHandler 的情况了,不设置的情况一测就 panic 了,而且是在一个 worker 里 panic,没法 recover""",github:GithubUser:1:8923413,2019-01-22T03:45:04.000+00:00,,0 -github:GithubPullRequest:1:456270386,github:GithubPullRequest:1:246250598,"""@choleraehyq \r\n三点:\r\n1. CI failed是因为TestPanicHandler测试失败了\r\n![image](https://user-images.githubusercontent.com/7496278/51513040-ba5fe680-1e43-11e9-92eb-6af6fa1242c9.png)\r\n2. 在Worker的recover里面,需要再加一个w.pool.decRunning(),因为panic之后这个goroutine就销毁了,所以要更新pool中的可用worker数量\r\n3. 麻烦在pool_func.go和worker_func.go里面也相应地加上PanicHandler的逻辑以及对应的unit tests\r\n\r\nThanks.""",github:GithubUser:1:7496278,2019-01-22T04:50:28.000+00:00,,0 -github:GithubPullRequest:1:456273052,github:GithubPullRequest:1:246250598,"""@panjf2000 thanks,修了""",github:GithubUser:1:8923413,2019-01-22T05:10:00.000+00:00,,0 -github:GithubPullRequest:1:456277710,github:GithubPullRequest:1:246250598,"""Thanks for your contributions to `ants`!""",github:GithubUser:1:7496278,2019-01-22T05:41:10.000+00:00,,0 +github:GithubPullRequest:1:407675431,github:GithubPullRequest:1:203756736,"""# [Codecov](https://codecov.io/gh/panjf2000/ants/pull/4?src=pr&el=h1) Report\n> Merging [#4](https://codecov.io/gh/panjf2000/ants/pull/4?src=pr&el=desc) into [master](https://codecov.io/gh/panjf2000/ants/commit/f5b37d0798a8e4c6780a1e08270fa50e979aa1d7?src=pr&el=desc) will **not change** coverage.\n> The diff coverage is `100%`.\n\n[![Impacted file tree graph](https://codecov.io/gh/panjf2000/ants/pull/4/graphs/tree.svg?token=JFa3laaGKq&width=650&height=150&src=pr)](https://codecov.io/gh/panjf2000/ants/pull/4?src=pr&el=tree)\n\n```diff\n@@ Coverage Diff @@\n## master #4 +/- ##\n=====================================\n Coverage 100% 100% \n=====================================\n Files 5 5 \n Lines 237 241 +4 \n=====================================\n+ Hits 237 241 +4\n```\n\n\n| [Impacted Files](https://codecov.io/gh/panjf2000/ants/pull/4?src=pr&el=tree) | Coverage Δ | |\n|---|---|---|\n| [worker.go](https://codecov.io/gh/panjf2000/ants/pull/4/diff?src=pr&el=tree#diff-d29ya2VyLmdv) | `100% <100%> (ø)` | :arrow_up: |\n| [worker\\_func.go](https://codecov.io/gh/panjf2000/ants/pull/4/diff?src=pr&el=tree#diff-d29ya2VyX2Z1bmMuZ28=) | `100% <100%> (ø)` | :arrow_up: |\n| [pool\\_func.go](https://codecov.io/gh/panjf2000/ants/pull/4/diff?src=pr&el=tree#diff-cG9vbF9mdW5jLmdv) | `100% <100%> (ø)` | :arrow_up: |\n| [pool.go](https://codecov.io/gh/panjf2000/ants/pull/4/diff?src=pr&el=tree#diff-cG9vbC5nbw==) | `100% <100%> (ø)` | :arrow_up: |\n\n------\n\n[Continue to review full report at Codecov](https://codecov.io/gh/panjf2000/ants/pull/4?src=pr&el=continue).\n> **Legend** - [Click here to learn more](https://docs.codecov.io/docs/codecov-delta)\n> `Δ = absolute (impact)`, `ø = not affected`, `? = missing data`\n> Powered by [Codecov](https://codecov.io/gh/panjf2000/ants/pull/4?src=pr&el=footer). Last update [f5b37d0...83042d7](https://codecov.io/gh/panjf2000/ants/pull/4?src=pr&el=lastupdated). Read the [comment docs](https://docs.codecov.io/docs/pull-request-comments).\n""",github:GithubAccount:1:22429695,2018-07-25T08:25:22.000+00:00,,0 +github:GithubPullRequest:1:407714136,github:GithubPullRequest:1:203756736,"""@barryz 改的不错,不过有一点需要商榷,那个预分配的大小,之前benchmark我记得1000w也只需要用到7w多,这样的话预分配5w对于大部分场景其实有点浪费,你有没有用修改后的代码benchmark一下,每次allocs/op应该是变大了吧""",github:GithubAccount:1:7496278,2018-07-25T10:49:44.000+00:00,,0 +github:GithubPullRequest:1:407755528,github:GithubPullRequest:1:203756736,"""@panjf2000 因为从压测结果来看, 1000W的场景下goroutine池的作用很明显, 尤其是在节省内存开销方面,所以在选择默认worker数量时,取了一个相对较大的值。 下面是benchmark 对比\r\n\r\nmaster:\r\n\r\n```\r\ngoos: linux\r\ngoarch: amd64\r\nBenchmarkGoroutineWithFunc-4 1 15079030287 ns/op 723120296 B/op 10176159 allocs/op\r\nPASS\r\nok command-line-arguments 15.106s\r\n```\r\n\r\nPR:\r\n```\r\ngoos: linux\r\ngoarch: amd64\r\nBenchmarkGoroutineWithFunc-4 1 15443376244 ns/op 720962888 B/op 10167850 allocs/op\r\nPASS\r\nok command-line-arguments 15.479s\r\n```\r\n""",github:GithubAccount:1:16658738,2018-07-25T13:33:42.000+00:00,,0 +github:GithubPullRequest:1:407764945,github:GithubPullRequest:1:203756736,"""@barryz 这样看起来预分配似乎没有太大的内存优势,相反在其他数量的任务量场景下可能还会有点浪费,这样吧,要不你先把预分配内存这一块的暂时移除,然后我合一下优化代码的部分,至于预分配内存这一块,后续再继续讨论下看看有没有能兼顾的办法""",github:GithubAccount:1:7496278,2018-07-25T14:02:41.000+00:00,,0 +github:GithubPullRequest:1:416794440,github:GithubPullRequest:1:211603583,"""@hongli-my 不好意思,我没太懂你的意图?能麻烦说详细点吗?""",github:GithubAccount:1:7496278,2018-08-29T01:39:23.000+00:00,,0 +github:GithubPullRequest:1:416794871,github:GithubPullRequest:1:211603583,"""# [Codecov](https://codecov.io/gh/panjf2000/ants/pull/8?src=pr&el=h1) Report\n> Merging [#8](https://codecov.io/gh/panjf2000/ants/pull/8?src=pr&el=desc) into [master](https://codecov.io/gh/panjf2000/ants/commit/666635c65d8d3bb1223b819325e0bd23c81f2733?src=pr&el=desc) will **decrease** coverage by `1.24%`.\n> The diff coverage is `100%`.\n\n[![Impacted file tree graph](https://codecov.io/gh/panjf2000/ants/pull/8/graphs/tree.svg?width=650&token=JFa3laaGKq&height=150&src=pr)](https://codecov.io/gh/panjf2000/ants/pull/8?src=pr&el=tree)\n\n```diff\n@@ Coverage Diff @@\n## master #8 +/- ##\n==========================================\n- Coverage 100% 98.75% -1.25% \n==========================================\n Files 5 5 \n Lines 241 241 \n==========================================\n- Hits 241 238 -3 \n- Misses 0 2 +2 \n- Partials 0 1 +1\n```\n\n\n| [Impacted Files](https://codecov.io/gh/panjf2000/ants/pull/8?src=pr&el=tree) | Coverage Δ | |\n|---|---|---|\n| [pool\\_func.go](https://codecov.io/gh/panjf2000/ants/pull/8/diff?src=pr&el=tree#diff-cG9vbF9mdW5jLmdv) | `100% <100%> (ø)` | :arrow_up: |\n| [pool.go](https://codecov.io/gh/panjf2000/ants/pull/8/diff?src=pr&el=tree#diff-cG9vbC5nbw==) | `97.19% <0%> (-2.81%)` | :arrow_down: |\n\n------\n\n[Continue to review full report at Codecov](https://codecov.io/gh/panjf2000/ants/pull/8?src=pr&el=continue).\n> **Legend** - [Click here to learn more](https://docs.codecov.io/docs/codecov-delta)\n> `Δ = absolute (impact)`, `ø = not affected`, `? = missing data`\n> Powered by [Codecov](https://codecov.io/gh/panjf2000/ants/pull/8?src=pr&el=footer). Last update [666635c...afd6871](https://codecov.io/gh/panjf2000/ants/pull/8?src=pr&el=lastupdated). Read the [comment docs](https://docs.codecov.io/docs/pull-request-comments).\n""",github:GithubAccount:1:22429695,2018-08-29T01:42:05.000+00:00,,0 +github:GithubPullRequest:1:416803651,github:GithubPullRequest:1:211603583,"""```n := 0\r\n\t\tfor i, w := range idleWorkers {\r\n\t\t\tif currentTime.Sub(w.recycleTime) <= p.expiryDuration {\r\n\t\t\t\tbreak\r\n\t\t\t}\r\n\t\t\tn = i\r\n\t\t\tw.args <- nil\r\n\t\t\tidleWorkers[i] = nil\r\n\t\t}\r\n\t\tn++\r\n\t\tif n >= len(idleWorkers) {\r\n\t\t\tp.workers = idleWorkers[:0]\r\n\t\t} else {\r\n\t\t\tp.workers = idleWorkers[n:]\r\n\t\t}```\r\nfor 循环中,如果for 循环没有满足条件,n 并没有复制,此时n ++, n 变为1, p.workers = idleWorkers[1:], idleWorkers[0] 丢弃了? 但是并没有w.args <- nil 操作""",github:GithubAccount:1:8597823,2018-08-29T02:34:07.000+00:00,,0 +github:GithubPullRequest:1:416818094,github:GithubPullRequest:1:211603583,"""@hongli-my 嗯,我知道了,但是你的修改似乎不完整,我已经在develop分支改了一版,要不你看下那个分支,然后按照那个再改一下,然后我再merge""",github:GithubAccount:1:7496278,2018-08-29T04:11:17.000+00:00,,0 +github:GithubPullRequest:1:421884048,github:GithubPullRequest:1:211603583,"""对于worker中的chan应该也需要close吧,当协程数量增大时,这种也是一种消耗""",github:GithubAccount:1:29241786,2018-09-17T03:37:44.000+00:00,,0 +github:GithubPullRequest:1:425423544,github:GithubPullRequest:1:218939809,"""@liyonglion 我看修改的代码应该是正确的,但是有两个问题:\r\n1. 要正确测试你pr,你要把ants_test.go里import ants的路径改成你自己的路径;\r\n2. 你现在只修改了pool.go的代码,麻烦把pool_func.go里相应的地方也优化一下。\r\n\r\n你重新修改一下pr,然后通过测试,我就merge了。""",github:GithubAccount:1:7496278,2018-09-28T12:43:30.000+00:00,,0 +github:GithubPullRequest:1:425428914,github:GithubPullRequest:1:218939809,"""我又仔细地想了想,在putWorker方法中,调用p.cond.Signal()之前,p.lock已经解锁了,如果这时候被\r\n![image](https://user-images.githubusercontent.com/7496278/46209831-824b0a00-c361-11e8-9109-609d21bab572.png)\r\n这里获得锁,则空闲队列中的刚刚放入的worker会被取出,这时候p.cond.Wait()再获得锁去队列中取worker的时候就会取不到,len(p.workers) - 1就会是-1,会报错:index out of range,和https://github.com/panjf2000/ants/issues/6 相似的问题,所以p.cond.Signal()应该放在putWorker中的p.lock.Lock()和p.lock.Unlock()之间。\r\n""",github:GithubAccount:1:7496278,2018-09-28T13:03:48.000+00:00,,0 +github:GithubPullRequest:1:425431081,github:GithubPullRequest:1:218939809,"""我明天仔细研究下。如果这个地方的死锁不好解决,其实可以使用另外一把锁,专门给条件变量使用。""",github:GithubAccount:1:12890888,2018-09-28T13:12:08.000+00:00,,0 +github:GithubPullRequest:1:425432498,github:GithubPullRequest:1:218939809,"""单一操作变量最好不要有多个锁,这样引发死锁的概率会非常高。""",github:GithubAccount:1:7496278,2018-09-28T13:17:44.000+00:00,,0 +github:GithubPullRequest:1:425438107,github:GithubPullRequest:1:218939809,"""新的锁只给条件变量使用,其他任何地方都不会使用。如果怕死锁,明天我封装一层,pool层只有一把锁。""",github:GithubAccount:1:12890888,2018-09-28T13:37:48.000+00:00,,0 +github:GithubPullRequest:1:425439137,github:GithubPullRequest:1:218939809,"""封装一层后,按照你的思路修改应该就可以了。""",github:GithubAccount:1:12890888,2018-09-28T13:41:20.000+00:00,,0 +github:GithubPullRequest:1:425608265,github:GithubPullRequest:1:218939809,"""看了下代码,你说的没错。我在测试下性能方面""",github:GithubAccount:1:12890888,2018-09-29T02:22:39.000+00:00,,0 +github:GithubPullRequest:1:425609411,github:GithubPullRequest:1:218939809,"""![image](https://user-images.githubusercontent.com/7496278/46240052-34bbb500-c3d4-11e8-809b-46b429039aee.png)\r\n你这改的有问题,取出来后没有对workers队列缩容,现在Travis CI整个卡住了""",github:GithubAccount:1:7496278,2018-09-29T02:41:56.000+00:00,,0 +github:GithubPullRequest:1:425609608,github:GithubPullRequest:1:218939809,"""嗯,到时候我会补上。容我再想想""",github:GithubAccount:1:12890888,2018-09-29T02:45:23.000+00:00,,0 +github:GithubPullRequest:1:425622339,github:GithubPullRequest:1:218939809,"""性能测试如下:\r\n100w的并发,5w的goroutine\r\n![snip20180929_3](https://user-images.githubusercontent.com/12890888/46242225-93932580-c3f8-11e8-841c-fc7fc620313d.png)\r\n\r\n![snip20180929_5](https://user-images.githubusercontent.com/12890888/46242227-9beb6080-c3f8-11e8-80fa-5d01da9aba19.png)\r\n""",github:GithubAccount:1:12890888,2018-09-29T07:02:56.000+00:00,,0 +github:GithubPullRequest:1:425622437,github:GithubPullRequest:1:218939809,"""# [Codecov](https://codecov.io/gh/panjf2000/ants/pull/13?src=pr&el=h1) Report\n> Merging [#13](https://codecov.io/gh/panjf2000/ants/pull/13?src=pr&el=desc) into [master](https://codecov.io/gh/panjf2000/ants/commit/af376f1b7b59dc488458bcecd4273f0fcde33c55?src=pr&el=desc) will **decrease** coverage by `90.38%`.\n> The diff coverage is `5%`.\n\n[![Impacted file tree graph](https://codecov.io/gh/panjf2000/ants/pull/13/graphs/tree.svg?width=650&token=JFa3laaGKq&height=150&src=pr)](https://codecov.io/gh/panjf2000/ants/pull/13?src=pr&el=tree)\n\n```diff\n@@ Coverage Diff @@\n## master #13 +/- ##\n==========================================\n- Coverage 98.75% 8.36% -90.39% \n==========================================\n Files 5 5 \n Lines 241 239 -2 \n==========================================\n- Hits 238 20 -218 \n- Misses 1 214 +213 \n- Partials 2 5 +3\n```\n\n\n| [Impacted Files](https://codecov.io/gh/panjf2000/ants/pull/13?src=pr&el=tree) | Coverage Δ | |\n|---|---|---|\n| [pool\\_func.go](https://codecov.io/gh/panjf2000/ants/pull/13/diff?src=pr&el=tree#diff-cG9vbF9mdW5jLmdv) | `0% <0%> (-97.23%)` | :arrow_down: |\n| [pool.go](https://codecov.io/gh/panjf2000/ants/pull/13/diff?src=pr&el=tree#diff-cG9vbC5nbw==) | `18.86% <10%> (-81.14%)` | :arrow_down: |\n| [worker\\_func.go](https://codecov.io/gh/panjf2000/ants/pull/13/diff?src=pr&el=tree#diff-d29ya2VyX2Z1bmMuZ28=) | `0% <0%> (-100%)` | :arrow_down: |\n| [worker.go](https://codecov.io/gh/panjf2000/ants/pull/13/diff?src=pr&el=tree#diff-d29ya2VyLmdv) | `0% <0%> (-100%)` | :arrow_down: |\n| [ants.go](https://codecov.io/gh/panjf2000/ants/pull/13/diff?src=pr&el=tree#diff-YW50cy5nbw==) | `0% <0%> (-100%)` | :arrow_down: |\n\n------\n\n[Continue to review full report at Codecov](https://codecov.io/gh/panjf2000/ants/pull/13?src=pr&el=continue).\n> **Legend** - [Click here to learn more](https://docs.codecov.io/docs/codecov-delta)\n> `Δ = absolute (impact)`, `ø = not affected`, `? = missing data`\n> Powered by [Codecov](https://codecov.io/gh/panjf2000/ants/pull/13?src=pr&el=footer). Last update [af376f1...1846b43](https://codecov.io/gh/panjf2000/ants/pull/13?src=pr&el=lastupdated). Read the [comment docs](https://docs.codecov.io/docs/pull-request-comments).\n""",github:GithubAccount:1:22429695,2018-09-29T07:05:01.000+00:00,,0 +github:GithubPullRequest:1:425623081,github:GithubPullRequest:1:218939809,"""@panjf2000 这个覆盖率怎么看?""",github:GithubAccount:1:12890888,2018-09-29T07:16:02.000+00:00,,0 +github:GithubPullRequest:1:425632550,github:GithubPullRequest:1:218939809,"""怎么会有负数。。。""",github:GithubAccount:1:7496278,2018-09-29T09:53:47.000+00:00,,0 +github:GithubPullRequest:1:425632613,github:GithubPullRequest:1:218939809,"""而且你那个取出worker之后还是没有对队列进行缩容吧""",github:GithubAccount:1:7496278,2018-09-29T09:54:48.000+00:00,,0 +github:GithubPullRequest:1:425632632,github:GithubPullRequest:1:218939809,"""这个我没玩过。。。。""",github:GithubAccount:1:12890888,2018-09-29T09:55:07.000+00:00,,0 +github:GithubPullRequest:1:425632777,github:GithubPullRequest:1:218939809,"""@panjf2000 我缩容了,具体哪个地方?""",github:GithubAccount:1:12890888,2018-09-29T09:57:34.000+00:00,,0 +github:GithubPullRequest:1:425637776,github:GithubPullRequest:1:218939809,"""@liyonglion 我看错了,缩容的补上了,这块没什么问题了,关于覆盖率这块我明天再查查。。。""",github:GithubAccount:1:7496278,2018-09-29T11:25:56.000+00:00,,0 +github:GithubPullRequest:1:425637938,github:GithubPullRequest:1:218939809,"""哦,我知道了,应该是那个import路径的问题导致的,那我先merge一下代码""",github:GithubAccount:1:7496278,2018-09-29T11:29:28.000+00:00,,0 +github:GithubPullRequest:1:425896318,github:GithubPullRequest:1:219363161,"""# [Codecov](https://codecov.io/gh/panjf2000/ants/pull/14?src=pr&el=h1) Report\n> Merging [#14](https://codecov.io/gh/panjf2000/ants/pull/14?src=pr&el=desc) into [master](https://codecov.io/gh/panjf2000/ants/commit/1b62696050b7030106291980d5220f886b017eff?src=pr&el=desc) will **decrease** coverage by `2.12%`.\n> The diff coverage is `100%`.\n\n[![Impacted file tree graph](https://codecov.io/gh/panjf2000/ants/pull/14/graphs/tree.svg?width=650&token=JFa3laaGKq&height=150&src=pr)](https://codecov.io/gh/panjf2000/ants/pull/14?src=pr&el=tree)\n\n```diff\n@@ Coverage Diff @@\n## master #14 +/- ##\n=========================================\n- Coverage 98.32% 96.2% -2.13% \n=========================================\n Files 5 5 \n Lines 239 237 -2 \n=========================================\n- Hits 235 228 -7 \n- Misses 2 4 +2 \n- Partials 2 5 +3\n```\n\n\n| [Impacted Files](https://codecov.io/gh/panjf2000/ants/pull/14?src=pr&el=tree) | Coverage Δ | |\n|---|---|---|\n| [pool.go](https://codecov.io/gh/panjf2000/ants/pull/14/diff?src=pr&el=tree#diff-cG9vbC5nbw==) | `96.19% <100%> (-1.93%)` | :arrow_down: |\n| [pool\\_func.go](https://codecov.io/gh/panjf2000/ants/pull/14/diff?src=pr&el=tree#diff-cG9vbF9mdW5jLmdv) | `95.28% <100%> (-2.85%)` | :arrow_down: |\n\n------\n\n[Continue to review full report at Codecov](https://codecov.io/gh/panjf2000/ants/pull/14?src=pr&el=continue).\n> **Legend** - [Click here to learn more](https://docs.codecov.io/docs/codecov-delta)\n> `Δ = absolute (impact)`, `ø = not affected`, `? = missing data`\n> Powered by [Codecov](https://codecov.io/gh/panjf2000/ants/pull/14?src=pr&el=footer). Last update [1b62696...5ed1687](https://codecov.io/gh/panjf2000/ants/pull/14?src=pr&el=lastupdated). Read the [comment docs](https://docs.codecov.io/docs/pull-request-comments).\n""",github:GithubAccount:1:22429695,2018-10-01T12:53:39.000+00:00,,0 +github:GithubPullRequest:1:425906970,github:GithubPullRequest:1:219363161,"""thanks for your correction and could you also modify the pool_func.go cuz there is also the same useless statement in that file. i will accept this pr after your modification is done, thanks.""",github:GithubAccount:1:7496278,2018-10-01T13:27:04.000+00:00,,0 +github:GithubPullRequest:1:426537013,github:GithubPullRequest:1:219936521,"""# [Codecov](https://codecov.io/gh/panjf2000/ants/pull/15?src=pr&el=h1) Report\n> Merging [#15](https://codecov.io/gh/panjf2000/ants/pull/15?src=pr&el=desc) into [master](https://codecov.io/gh/panjf2000/ants/commit/29730bb70343924a2f56a13a9799611dd1cd27fd?src=pr&el=desc) will **decrease** coverage by `0.84%`.\n> The diff coverage is `n/a`.\n\n[![Impacted file tree graph](https://codecov.io/gh/panjf2000/ants/pull/15/graphs/tree.svg?width=650&token=JFa3laaGKq&height=150&src=pr)](https://codecov.io/gh/panjf2000/ants/pull/15?src=pr&el=tree)\n\n```diff\n@@ Coverage Diff @@\n## master #15 +/- ##\n=========================================\n- Coverage 97.04% 96.2% -0.85% \n=========================================\n Files 5 5 \n Lines 237 237 \n=========================================\n- Hits 230 228 -2 \n- Misses 3 4 +1 \n- Partials 4 5 +1\n```\n\n\n| [Impacted Files](https://codecov.io/gh/panjf2000/ants/pull/15?src=pr&el=tree) | Coverage Δ | |\n|---|---|---|\n| [pool.go](https://codecov.io/gh/panjf2000/ants/pull/15/diff?src=pr&el=tree#diff-cG9vbC5nbw==) | `96.19% <0%> (-1.91%)` | :arrow_down: |\n\n------\n\n[Continue to review full report at Codecov](https://codecov.io/gh/panjf2000/ants/pull/15?src=pr&el=continue).\n> **Legend** - [Click here to learn more](https://docs.codecov.io/docs/codecov-delta)\n> `Δ = absolute (impact)`, `ø = not affected`, `? = missing data`\n> Powered by [Codecov](https://codecov.io/gh/panjf2000/ants/pull/15?src=pr&el=footer). Last update [29730bb...3070771](https://codecov.io/gh/panjf2000/ants/pull/15?src=pr&el=lastupdated). Read the [comment docs](https://docs.codecov.io/docs/pull-request-comments).\n""",github:GithubAccount:1:22429695,2018-10-03T07:23:08.000+00:00,,0 +github:GithubPullRequest:1:426596957,github:GithubPullRequest:1:219936521,"""@egonelbre thanks for your interest in this repository and i got some puzzles.\r\nfirstly, i don't understand why you use both the chan struct{} and sync.WaitGroup at once, that seems a bit excessive cuz waitgroup and chan did the same thing.\r\nsecondly, method BenchmarkGoroutine was design to test throughput so it should run without waitgroup.""",github:GithubAccount:1:7496278,2018-10-03T11:05:45.000+00:00,,0 +github:GithubPullRequest:1:426604764,github:GithubPullRequest:1:219936521,"""Hi, semaphore acts as protection to avoid starting too many goroutines at once. `WaitGroup` is used to wait for everything to complete.\r\n\r\n`BenchmarkGoroutine` doesn't wait for all the goroutines to finish, so you are testing goroutine startup speed rather than throughput. It's somewhat unclear what you mean by \""throughput\"" in this case, but either way you would need to wait for all goroutines to finish, otherwise they will start affecting all other benchmarks. If you do want to benchmark goroutine startup speed, then you would need to add `b.StopTimer` before `wg.Wait`.""",github:GithubAccount:1:192964,2018-10-03T11:37:48.000+00:00,,0 +github:GithubPullRequest:1:429609579,github:GithubPullRequest:1:222703171,"""# [Codecov](https://codecov.io/gh/panjf2000/ants/pull/16?src=pr&el=h1) Report\n> Merging [#16](https://codecov.io/gh/panjf2000/ants/pull/16?src=pr&el=desc) into [master](https://codecov.io/gh/panjf2000/ants/commit/711dbdb7a222771ce15aaee1bb7b7c6e9731f208?src=pr&el=desc) will **decrease** coverage by `2.03%`.\n> The diff coverage is `0%`.\n\n[![Impacted file tree graph](https://codecov.io/gh/panjf2000/ants/pull/16/graphs/tree.svg?width=650&token=JFa3laaGKq&height=150&src=pr)](https://codecov.io/gh/panjf2000/ants/pull/16?src=pr&el=tree)\n\n```diff\n@@ Coverage Diff @@\n## master #16 +/- ##\n==========================================\n- Coverage 97.46% 95.43% -2.04% \n==========================================\n Files 5 5 \n Lines 237 241 +4 \n==========================================\n- Hits 231 230 -1 \n- Misses 3 5 +2 \n- Partials 3 6 +3\n```\n\n\n| [Impacted Files](https://codecov.io/gh/panjf2000/ants/pull/16?src=pr&el=tree) | Coverage Δ | |\n|---|---|---|\n| [pool.go](https://codecov.io/gh/panjf2000/ants/pull/16/diff?src=pr&el=tree#diff-cG9vbC5nbw==) | `94.39% <0%> (-1.8%)` | :arrow_down: |\n| [pool\\_func.go](https://codecov.io/gh/panjf2000/ants/pull/16/diff?src=pr&el=tree#diff-cG9vbF9mdW5jLmdv) | `95.37% <0%> (-2.75%)` | :arrow_down: |\n\n------\n\n[Continue to review full report at Codecov](https://codecov.io/gh/panjf2000/ants/pull/16?src=pr&el=continue).\n> **Legend** - [Click here to learn more](https://docs.codecov.io/docs/codecov-delta)\n> `Δ = absolute (impact)`, `ø = not affected`, `? = missing data`\n> Powered by [Codecov](https://codecov.io/gh/panjf2000/ants/pull/16?src=pr&el=footer). Last update [711dbdb...439348b](https://codecov.io/gh/panjf2000/ants/pull/16?src=pr&el=lastupdated). Read the [comment docs](https://docs.codecov.io/docs/pull-request-comments).\n""",github:GithubAccount:1:22429695,2018-10-14T09:24:39.000+00:00,,0 +github:GithubPullRequest:1:433821356,github:GithubPullRequest:1:211603583,"""这种bugfix是不是应该赶紧修了?""",github:GithubAccount:1:8923413,2018-10-29T08:10:59.000+00:00,,0 +github:GithubPullRequest:1:434126048,github:GithubPullRequest:1:211603583,"""@choleraehyq 这个很早就已经修复了这个pr一直忘了关。""",github:GithubAccount:1:7496278,2018-10-30T00:10:32.000+00:00,,0 +github:GithubPullRequest:1:434126349,github:GithubPullRequest:1:211603583,"""@MrDragon1122 一般来说channel是不需要显式close的,只要没有goroutine持有channel,相关资源会自动释放。""",github:GithubAccount:1:7496278,2018-10-30T00:12:13.000+00:00,,0 +github:GithubPullRequest:1:439758381,github:GithubPullRequest:1:231840723,"""# [Codecov](https://codecov.io/gh/panjf2000/ants/pull/19?src=pr&el=h1) Report\n> Merging [#19](https://codecov.io/gh/panjf2000/ants/pull/19?src=pr&el=desc) into [develop](https://codecov.io/gh/panjf2000/ants/commit/92acf74bb71c1dc1758c61346c88325284978b3e?src=pr&el=desc) will **increase** coverage by `0.02%`.\n> The diff coverage is `100%`.\n\n[![Impacted file tree graph](https://codecov.io/gh/panjf2000/ants/pull/19/graphs/tree.svg?width=650&token=JFa3laaGKq&height=150&src=pr)](https://codecov.io/gh/panjf2000/ants/pull/19?src=pr&el=tree)\n\n```diff\n@@ Coverage Diff @@\n## develop #19 +/- ##\n===========================================\n+ Coverage 97.46% 97.48% +0.02% \n===========================================\n Files 5 5 \n Lines 237 239 +2 \n===========================================\n+ Hits 231 233 +2 \n Misses 3 3 \n Partials 3 3\n```\n\n\n| [Impacted Files](https://codecov.io/gh/panjf2000/ants/pull/19?src=pr&el=tree) | Coverage Δ | |\n|---|---|---|\n| [pool.go](https://codecov.io/gh/panjf2000/ants/pull/19/diff?src=pr&el=tree#diff-cG9vbC5nbw==) | `96.22% <100%> (+0.03%)` | :arrow_up: |\n| [pool\\_func.go](https://codecov.io/gh/panjf2000/ants/pull/19/diff?src=pr&el=tree#diff-cG9vbF9mdW5jLmdv) | `98.13% <100%> (+0.01%)` | :arrow_up: |\n\n------\n\n[Continue to review full report at Codecov](https://codecov.io/gh/panjf2000/ants/pull/19?src=pr&el=continue).\n> **Legend** - [Click here to learn more](https://docs.codecov.io/docs/codecov-delta)\n> `Δ = absolute (impact)`, `ø = not affected`, `? = missing data`\n> Powered by [Codecov](https://codecov.io/gh/panjf2000/ants/pull/19?src=pr&el=footer). Last update [92acf74...e7bacd0](https://codecov.io/gh/panjf2000/ants/pull/19?src=pr&el=lastupdated). Read the [comment docs](https://docs.codecov.io/docs/pull-request-comments).\n""",github:GithubAccount:1:22429695,2018-11-19T03:06:06.000+00:00,,0 +github:GithubPullRequest:1:439758480,github:GithubPullRequest:1:231840723,"""我自己写了测试示例\r\n重复\r\nants.NewPoolWithFunc()\r\n然后\r\n进行Resize(0) && Release\r\n但仍发现内存泄漏现象,追溯到了NewTicker没有进行Stop可能导致\r\n\r\nflat flat% sum% cum cum%\r\n\r\n 7168.57kB 77.60% 77.60% 7168.57kB 77.60% time.NewTicker\r\n\r\n\r\n\r\n""",github:GithubAccount:1:7931755,2018-11-19T03:06:50.000+00:00,,0 +github:GithubPullRequest:1:439781607,github:GithubPullRequest:1:231840723,"""突然看到一个PR有更完善的解决方式,不知道为啥没有PR成功""",github:GithubAccount:1:7931755,2018-11-19T06:07:43.000+00:00,,0 +github:GithubPullRequest:1:439793352,github:GithubPullRequest:1:231840723,"""另外一个pr跟你大概是完成类似的功能,不过那个failed之后作者就没再更新了,所以就没有merge,你要是有时间不如参考下他的代码再优化下?就放到这个pr里。""",github:GithubAccount:1:7496278,2018-11-19T07:14:58.000+00:00,,0 +github:GithubPullRequest:1:456033956,github:GithubPullRequest:1:246250598,"""# [Codecov](https://codecov.io/gh/panjf2000/ants/pull/23?src=pr&el=h1) Report\n> Merging [#23](https://codecov.io/gh/panjf2000/ants/pull/23?src=pr&el=desc) into [master](https://codecov.io/gh/panjf2000/ants/commit/812dd4e01075be3cf97429a43abaf6837908cdcd?src=pr&el=desc) will **decrease** coverage by `1.02%`.\n> The diff coverage is `71.42%`.\n\n[![Impacted file tree graph](https://codecov.io/gh/panjf2000/ants/pull/23/graphs/tree.svg?width=650&token=JFa3laaGKq&height=150&src=pr)](https://codecov.io/gh/panjf2000/ants/pull/23?src=pr&el=tree)\n\n```diff\n@@ Coverage Diff @@\n## master #23 +/- ##\n==========================================\n- Coverage 97.07% 96.04% -1.03% \n==========================================\n Files 5 5 \n Lines 239 253 +14 \n==========================================\n+ Hits 232 243 +11 \n- Misses 3 5 +2 \n- Partials 4 5 +1\n```\n\n\n| [Impacted Files](https://codecov.io/gh/panjf2000/ants/pull/23?src=pr&el=tree) | Coverage Δ | |\n|---|---|---|\n| [pool\\_func.go](https://codecov.io/gh/panjf2000/ants/pull/23/diff?src=pr&el=tree#diff-cG9vbF9mdW5jLmdv) | `98.13% <ø> (+2.8%)` | :arrow_up: |\n| [pool.go](https://codecov.io/gh/panjf2000/ants/pull/23/diff?src=pr&el=tree#diff-cG9vbC5nbw==) | `96.22% <ø> (-1.89%)` | :arrow_down: |\n| [worker\\_func.go](https://codecov.io/gh/panjf2000/ants/pull/23/diff?src=pr&el=tree#diff-d29ya2VyX2Z1bmMuZ28=) | `86.66% <71.42%> (-13.34%)` | :arrow_down: |\n| [worker.go](https://codecov.io/gh/panjf2000/ants/pull/23/diff?src=pr&el=tree#diff-d29ya2VyLmdv) | `86.66% <71.42%> (-13.34%)` | :arrow_down: |\n\n------\n\n[Continue to review full report at Codecov](https://codecov.io/gh/panjf2000/ants/pull/23?src=pr&el=continue).\n> **Legend** - [Click here to learn more](https://docs.codecov.io/docs/codecov-delta)\n> `Δ = absolute (impact)`, `ø = not affected`, `? = missing data`\n> Powered by [Codecov](https://codecov.io/gh/panjf2000/ants/pull/23?src=pr&el=footer). Last update [812dd4e...5bbc9e1](https://codecov.io/gh/panjf2000/ants/pull/23?src=pr&el=lastupdated). Read the [comment docs](https://docs.codecov.io/docs/pull-request-comments).\n""",github:GithubAccount:1:22429695,2019-01-21T11:00:28.000+00:00,,0 +github:GithubPullRequest:1:456071084,github:GithubPullRequest:1:246250598,"""@choleraehyq \r\nbuild失败了,解决一下?""",github:GithubAccount:1:7496278,2019-01-21T13:18:19.000+00:00,,0 +github:GithubPullRequest:1:456261758,github:GithubPullRequest:1:246250598,"""@panjf2000 这是测试覆盖率的问题吧,我已经测了设置 PanicHandler 的情况了,不设置的情况一测就 panic 了,而且是在一个 worker 里 panic,没法 recover""",github:GithubAccount:1:8923413,2019-01-22T03:45:04.000+00:00,,0 +github:GithubPullRequest:1:456270386,github:GithubPullRequest:1:246250598,"""@choleraehyq \r\n三点:\r\n1. CI failed是因为TestPanicHandler测试失败了\r\n![image](https://user-images.githubusercontent.com/7496278/51513040-ba5fe680-1e43-11e9-92eb-6af6fa1242c9.png)\r\n2. 在Worker的recover里面,需要再加一个w.pool.decRunning(),因为panic之后这个goroutine就销毁了,所以要更新pool中的可用worker数量\r\n3. 麻烦在pool_func.go和worker_func.go里面也相应地加上PanicHandler的逻辑以及对应的unit tests\r\n\r\nThanks.""",github:GithubAccount:1:7496278,2019-01-22T04:50:28.000+00:00,,0 +github:GithubPullRequest:1:456273052,github:GithubPullRequest:1:246250598,"""@panjf2000 thanks,修了""",github:GithubAccount:1:8923413,2019-01-22T05:10:00.000+00:00,,0 +github:GithubPullRequest:1:456277710,github:GithubPullRequest:1:246250598,"""Thanks for your contributions to `ants`!""",github:GithubAccount:1:7496278,2019-01-22T05:41:10.000+00:00,,0 diff --git a/plugins/github/e2e/snapshot_tables/pull_requests.csv b/plugins/github/e2e/snapshot_tables/pull_requests.csv index 57814febafc..7efbe758661 100644 --- a/plugins/github/e2e/snapshot_tables/pull_requests.csv +++ b/plugins/github/e2e/snapshot_tables/pull_requests.csv @@ -1,50 +1,50 @@ id,base_repo_id,head_repo_id,status,title,description,url,author_name,author_id,parent_pr_id,pull_request_key,created_date,merged_date,closed_date,type,component,merge_commit_sha,head_ref,base_ref,base_commit_sha,head_commit_sha -github:GithubPullRequest:1:203756736,github:GithubRepo:1:134018330,,closed,pre-allocate the capacity of the worker listpre-allocate the capacity of the worker listpre-allocate the capacity of the worker listpre-allocate the capacity of the worker listpre-allocate the capacity of the worker listpre-allocate the capacity of the worker listpre-allocate the capacity of the worker listpre-allocate the capacity of the worker listpre-allocate the capacity of the worker listpre-allocate the capacity of the worker listpre-allocate the capacity of the worker listpre-allocate the capacity of the worker listpre-allocate the capacity of the worker listpre-allocate the capacity of the worker listpre-allocate the capacity of the worker listpre-allocate the capacity of the worker listpre-allocate the capacity of the worker listpre-allocate the capacity of the worker listpre-allocate the capacity of the worker listpre-allocate the capacity of the worker listpre-allocate the capacity of the worker listpre-allocate the capacity of the worker listpre-allocate the capacity of the worker listpre-allocate the capacity of the worker listpre-allocate the capacity of the worker listpre-allocate the capacity of the worker listpre-allocate the capacity of the worker list,"""fix #3 \r\n* 链表实际测过, 性能相差无几, 但内存占用高了几倍\r\n* 初始化`Pool`和`PoolFunc`是给定了个默认的worker capacity\r\n* 优化了下其他代码""",https://github.com/panjf2000/ants/pull/4,barryz,github:GithubUser:1:16658738,,4,2018-07-25T08:19:30.000+00:00,2018-07-26T02:32:41.000+00:00,2018-07-26T02:32:41.000+00:00,,,3ddd58c390b0f928a5782c235f90ad0c9c21312c,pre_allocate,master,f5b37d0798a8e4c6780a1e08270fa50e979aa1d7,83042d709562a53973c78901ca5df7e7cddbe677 -github:GithubPullRequest:1:211603583,github:GithubRepo:1:134018330,,closed,fix goroutine leak,"""n++, will cause workers[0] leak""",https://github.com/panjf2000/ants/pull/8,hongli-my,github:GithubUser:1:8597823,,8,2018-08-29T01:35:54.000+00:00,,2018-10-30T00:12:13.000+00:00,,,74ba726f34abe487b7defac6bb9bebf24d342377,dev,master,666635c65d8d3bb1223b819325e0bd23c81f2733,afd687164b13280199208ec4869709edcf02b52d -github:GithubPullRequest:1:212277907,github:GithubRepo:1:134018330,,closed,Update pool.go,"""#活着的孩子不想当孤儿\r\n\tHopefully:\r\n\tchildren := []*child{C1,C2,C3,C4,C5,C6,C7}\r\n\tIn fact:\r\n\tchildren := []*child{C1,C4,C2,C3,C5,C6,C7}""",https://github.com/panjf2000/ants/pull/9,Nonnnnnnnnn,github:GithubUser:1:42808204,,9,2018-08-31T05:29:36.000+00:00,,2018-08-31T13:40:33.000+00:00,,,f14d3f91f68d0bc23fe42aa413e98005f6575045,patch-1,master,666635c65d8d3bb1223b819325e0bd23c81f2733,2726d42ea62857283ee73ef3611e379b60974ad2 -github:GithubPullRequest:1:216254598,github:GithubRepo:1:134018330,,closed,graceful exit,"""graceful exit""",https://github.com/panjf2000/ants/pull/11,shanhuhai5739,github:GithubUser:1:3794113,,11,2018-09-18T10:15:01.000+00:00,,2018-12-03T03:52:35.000+00:00,,,6a87067eb3d6440e5db17f31d4bc12ac291633f4,master,develop,833b6e29acfb2f16e3cf7fc92c79763847c319f4,a03eccc794870f0a2e55a5cb8344ea47f2a0001d -github:GithubPullRequest:1:218939809,github:GithubRepo:1:134018330,,closed,❓解决死循环导致cpu占用率过高,"""使用了cond 条件变量来阻塞Submit goroutine。潘少,你再仔细琢磨琢磨,看下有何不妥?""",https://github.com/panjf2000/ants/pull/13,liyonglion,github:GithubUser:1:12890888,,13,2018-09-28T11:37:28.000+00:00,2018-09-29T11:29:54.000+00:00,2018-09-29T11:29:54.000+00:00,,,9a3b5cd25344822bca7684f87d9e123890a7bf59,master,master,af376f1b7b59dc488458bcecd4273f0fcde33c55,1846b4392a3a20e6bf1a7431b67f86bd43e0f0b9 -github:GithubPullRequest:1:219363161,github:GithubRepo:1:134018330,,closed,Remove meaningless if statements,"""""",https://github.com/panjf2000/ants/pull/14,SimePel,github:GithubUser:1:20608155,,14,2018-10-01T12:48:11.000+00:00,2018-10-02T13:52:27.000+00:00,2018-10-02T13:52:27.000+00:00,,,29730bb70343924a2f56a13a9799611dd1cd27fd,master,master,1b62696050b7030106291980d5220f886b017eff,5ed168767a771e3802252020b9821610380ed1a4 -github:GithubPullRequest:1:219936521,github:GithubRepo:1:134018330,,closed,Fixes to benchmarks and added semaphore comparison,"""Benchmark results with Param=0, as time.Sleep is not stable on Windows\r\n\r\nAlso Go 1.11 has bunch of improvements:\r\n\r\n```\r\ngoos: windows\r\ngoarch: amd64\r\npkg: github.com/panjf2000/ants\r\nBenchmarkGoroutineWithFunc-8 1 3530220300 ns/op 207472 B/op 506 allocs/op\r\nBenchmarkSemaphoreWithFunc-8 1 4391916400 ns/op 20944 B/op 57 allocs/op\r\nBenchmarkAntsPoolWithFunc-8 1 5496395400 ns/op 164240 B/op 2059 allocs/op\r\nBenchmarkGoroutine-8 1 3327413400 ns/op 1552 B/op 5 allocs/op\r\nBenchmarkSemaphore-8 1 4499816000 ns/op 1264 B/op 5 allocs/op\r\nBenchmarkAntsPool-8 1 5456432100 ns/op 49208 B/op 809 allocs/op\r\nPASS\r\n```""",https://github.com/panjf2000/ants/pull/15,egonelbre,github:GithubUser:1:192964,,15,2018-10-03T07:16:16.000+00:00,2018-10-03T12:33:59.000+00:00,2018-10-03T12:33:59.000+00:00,,,c10f80f7b760ba68bef1759f6e7921ba5e34b889,fix-benchmarks,master,29730bb70343924a2f56a13a9799611dd1cd27fd,3070771e41f0df591619c94ed0bc5c8025451302 -github:GithubPullRequest:1:222703171,github:GithubRepo:1:134018330,,closed,bugfix(check max pool size),"""if you limit max goroutine to math.Maxint32 as your code `int32(pool size)`\r\nI think should check max Goroutine size, otherwise size overflow to negative?\r\n""",https://github.com/panjf2000/ants/pull/16,rikewang,github:GithubUser:1:24841832,,16,2018-10-14T09:21:41.000+00:00,,2018-12-03T03:53:31.000+00:00,,,1399cfa28f6751f769a985206daecb56a08b2de9,bugfix_check_max_pool_size,master,711dbdb7a222771ce15aaee1bb7b7c6e9731f208,439348b027031c793e54669fcd74eb4964c15055 -github:GithubPullRequest:1:231840723,github:GithubRepo:1:134018330,,closed,Possible memory leak because of Ticker,"""// NewTicker returns a new Ticker containing a channel that will send the\r\n// time with a period specified by the duration argument.\r\n// It adjusts the intervals or drops ticks to make up for slow receivers.\r\n// The duration d must be greater than zero; if not, NewTicker will panic.\r\n// Stop the ticker to release associated resources.\r\nfunc NewTicker(d Duration) *Ticker {\r\n……\r\n}""",https://github.com/panjf2000/ants/pull/19,zplzpl,github:GithubUser:1:7931755,,19,2018-11-19T03:03:09.000+00:00,2018-12-01T15:49:32.000+00:00,2018-12-01T15:49:32.000+00:00,,,639f55c4c94407632a1c5e34cd71784524de0757,hotfix/tickerStop,develop,92acf74bb71c1dc1758c61346c88325284978b3e,e7bacd0f127fcde1399f92452bd0039f58916fed -github:GithubPullRequest:1:246250598,github:GithubRepo:1:134018330,,closed,feature: add PanicHandler,"""@panjf2000 PTAL\r\nFix #22 \r\nSigned-off-by: Cholerae Hu """,https://github.com/panjf2000/ants/pull/23,choleraehyq,github:GithubUser:1:8923413,,23,2019-01-21T10:58:15.000+00:00,2019-01-22T05:41:34.000+00:00,2019-01-22T05:41:34.000+00:00,,,9158bd37025ccdd29d6346a6639a282e0060c7e2,panichandler,master,812dd4e01075be3cf97429a43abaf6837908cdcd,5bbc9e170bbee27c37bcc30da3da75b4531d1edb -github:GithubPullRequest:1:267414275,github:GithubRepo:1:134018330,,closed,goreport: lint warning on code comment structure,"""Added a newline between group comment and exported variable line 😄""",https://github.com/panjf2000/ants/pull/30,sarathsp06,github:GithubUser:1:964542,,30,2019-04-04T11:52:48.000+00:00,2019-04-23T11:11:58.000+00:00,2019-04-23T11:11:58.000+00:00,,,dec04010834ccd3691eb1776045ce3b9310ce26c,patch-1,master,4ae3fb8dc413492862469027bb58cb45b77338f1,ec5d1f3b8107265cb53536975504c7cda4f6d68f -github:GithubPullRequest:1:292246524,github:GithubRepo:1:134018330,,closed,handle job panic,"""""",https://github.com/panjf2000/ants/pull/36,king526,github:GithubUser:1:38849208,,36,2019-06-27T03:27:05.000+00:00,,2019-08-17T20:32:34.000+00:00,,,95e11bf85f18a80197918d15a19ec10f41903d63,master,master,05e96abd6103ae7b70436abe58dbc0ad7e740929,39f04c6e65b76b5f20abd3ca0606db4cd038e5c2 -github:GithubPullRequest:1:300598936,github:GithubRepo:1:134018330,,closed,优化清理速度并修复内存泄漏,"""""",https://github.com/panjf2000/ants/pull/39,wwjiang,github:GithubUser:1:1290360,,39,2019-07-24T07:41:02.000+00:00,2019-07-26T04:00:12.000+00:00,2019-07-26T04:00:12.000+00:00,,,21a109c7f0873c8f466d6710de23474968940011,master,master,fc48d32604efc2b36d144b8f83d34c1aa1fda1c9,b44a12884b495713a44f796981267ed87134decb -github:GithubPullRequest:1:301421607,github:GithubRepo:1:134018330,,closed,"optimize memory allocation, change the default pool param and add the log of panic stack.","""Hi, I am using it on my online server which almost need 5 million goroutines on each go service.\r\nI'm divided into 10 small pools, because a pool of five million will slow down the speed associated with the slice.\r\nI made some small optimizations, I hope this is useful.\r\noptimize memory allocation, change the default pool param and add the log of panic stack.\r\nbtw, the default value DEFAULT_CLEAN_INTERVAL_TIME, one second is too short-lived. when the pool size is too large , Performance will drop .\r\n""",https://github.com/panjf2000/ants/pull/40,Anteoy,github:GithubUser:1:17495446,,40,2019-07-26T07:07:06.000+00:00,2019-07-26T15:22:26.000+00:00,2019-07-26T15:22:26.000+00:00,,,3e1c7a03a512a7de8c9049d56237e5d2de2f30eb,master,master,f447bf104a4eff069b6019db406c31dd54d7b3ef,5dc8b9a71737eb57dc03fbbe3eb9010ff6c3fbb6 -github:GithubPullRequest:1:308859272,github:GithubRepo:1:134018330,,closed,support nonblocking submit and max blocking limit setting,"""Signed-off-by: Cholerae Hu """,https://github.com/panjf2000/ants/pull/41,choleraehyq,github:GithubUser:1:8923413,,41,2019-08-20T03:24:27.000+00:00,2019-08-20T10:55:19.000+00:00,2019-08-20T10:55:19.000+00:00,,,faef79b7d8a4876da8a215d7794cce20c710aaa2,nonblocking,master,dc8169d5c2645bfc507d6993b7d215326300f31b,58466b12b03a603d9f0331bbcc64a7557b27865d -github:GithubPullRequest:1:311420898,github:GithubRepo:1:134018330,,closed,Create CODE_OF_CONDUCT.md,"""""",https://github.com/panjf2000/ants/pull/48,panjf2000,github:GithubUser:1:7496278,,48,2019-08-27T14:44:03.000+00:00,2019-08-27T14:46:22.000+00:00,2019-08-27T14:46:22.000+00:00,,,d5eded45bffe827e5a64a3376c4b94f08b641031,add-code-of-conduct-1,master,44aec9954f58987c37d5937ba590bbf0812a32de,bba6c12b60eff3445adcc168fff3bfdcad9e2571 -github:GithubPullRequest:1:316337433,github:GithubRepo:1:134018330,,closed,Invoke decRunning() when revertWorker() returns false,"""Signed-off-by: Cholerae Hu \r\n\r\n---\r\nname: Pull request\r\nabout: Propose changes to the code\r\ntitle: ''\r\nlabels: ''\r\nassignees: ''\r\n---\r\n\r\n\r\n\r\n## 1. Are you opening this pull request for bug-fixs, optimizations or new feature?\r\n\r\n\r\n\r\n## 2. Please describe how these code changes achieve your intention.\r\n\r\n\r\n\r\n\r\n## 3. Please link to the relevant issues (if any).\r\n\r\n\r\n\r\n\r\n## 4. Which documentation changes (if any) need to be made/updated because of this PR?\r\n\r\n\r\n\r\n\r\n## 4. Checklist\r\n\r\n- [ ] I have squashed all insignificant commits.\r\n- [ ] I have commented my code for explaining package types, values, functions, and non-obvious lines.\r\n- [ ] I have written unit tests and verified that all tests passes (if needed).\r\n- [ ] I have documented feature info on the README (only when this PR is adding a new feature).\r\n- [ ] (optional) I am willing to help maintain this change if there are issues with it later.\r\n""",https://github.com/panjf2000/ants/pull/51,choleraehyq,github:GithubUser:1:8923413,,51,2019-09-11T08:46:23.000+00:00,2019-09-12T01:00:32.000+00:00,2019-09-12T01:00:32.000+00:00,,,d6cd5a7e726c9bb8578e7aabdbf3488dc8d080b6,fixbug,master,280ac345a860e794df1268e15112db9a863900ca,6495acc77318c3944e3edd3f983a03fc9027324a -github:GithubPullRequest:1:325179595,github:GithubRepo:1:134018330,,closed,add loop queue ,"""---\r\nname: Pull request\r\nabout: 抽象出worker队列的实现,使用原先和循环队列实现这个接口\r\ntitle: ''\r\nlabels: ''\r\nassignees: ''\r\n---\r\n\r\n\r\n\r\n## 1. Are you opening this pull request for bug-fixs, optimizations or new feature?\r\n抽象了 worker 队列,实现了两种队列的方式,也可以方便的新加队列实现,只要符合 WorkerQueue 即可\r\n\r\n## 2. Please describe how these code changes achieve your intention.\r\n\r\n1. 抽象woker队列为WorkerQueue 的 interface{}\r\n2. 模仿之前的方式实现了 SliceQueue 队列,还是使用了 slice\r\n3. 新加了循环队列 LoopQueue,也是使用 slice 实现,但是会减少内存的copy操作(原先会在periodicallyPurge有slice拷贝的操作)\r\n4. 修改了在查询超时时间时,使用二分查找的算法。\r\n\r\n潘少,目前我修改了 pool。如果潘少觉得这个方案可行,我可以再把 PoolWithFunc 按照这种方式修改。\r\n\r\n## 3. Please link to the relevant issues (if any).\r\n\r\n\r\n\r\n\r\n## 4. Which documentation changes (if any) need to be made/updated because of this PR?\r\n\r\n\r\n\r\n\r\n## 4. Checklist\r\n\r\n- [x] I have squashed all insignificant commits.\r\n- [ ] I have commented my code for explaining package types, values, functions, and non-obvious lines.\r\n- [x] I have written unit tests and verified that all tests passes (if needed).\r\n- [ ] I have documented feature info on the README (only when this PR is adding a new feature).\r\n- [ ] (optional) I am willing to help maintain this change if there are issues with it later.\r\n""",https://github.com/panjf2000/ants/pull/53,KevinBaiSg,github:GithubUser:1:2813260,,53,2019-10-07T08:17:20.000+00:00,2019-10-09T16:59:19.000+00:00,2019-10-09T16:59:19.000+00:00,,,f0e23928f4388661a8e0f6f5ff93f8f9514a1762,feature/loopQueue,master,66350c88dbd991f49ca95454e2d8485ca990fd30,6ef45a0a1fd2ad8878c5684e9ec1baf8aab24f87 -github:GithubPullRequest:1:329127652,github:GithubRepo:1:134018330,,closed,throw out default panic,"""\r\n5.10. Recover\r\nRecovering indiscriminately from panics is a dubious practice because the state of a package’s variables after a panic is rarely well defined or documented. Perhaps a critical update to a data structure was incomplete, a file or net work connection was opened but not closed, or a lock was acquired but not released. Furthermore, by replacing a crash with, say, a line in a log file, indiscriminate recovery may cause bugs to go unnoticed.\r\n\r\n---\r\nname: Pull request\r\nabout: Propose changes to the code\r\ntitle: ''\r\nlabels: ''\r\nassignees: ''\r\n---\r\n\r\n\r\n\r\n## 1. Are you opening this pull request for bug-fixs, optimizations or new feature?\r\n\r\n\r\n\r\n## 2. Please describe how these code changes achieve your intention.\r\n\r\n\r\n\r\n\r\n## 3. Please link to the relevant issues (if any).\r\n\r\n\r\n\r\n\r\n## 4. Which documentation changes (if any) need to be made/updated because of this PR?\r\n\r\n\r\n\r\n\r\n## 4. Checklist\r\n\r\n- [ ] I have squashed all insignificant commits.\r\n- [ ] I have commented my code for explaining package types, values, functions, and non-obvious lines.\r\n- [ ] I have written unit tests and verified that all tests passes (if needed).\r\n- [ ] I have documented feature info on the README (only when this PR is adding a new feature).\r\n- [x] (optional) I am willing to help maintain this change if there are issues with it later.\r\n""",https://github.com/panjf2000/ants/pull/54,polar9527,github:GithubUser:1:8644923,,54,2019-10-17T08:18:41.000+00:00,,2019-10-18T02:07:14.000+00:00,,,f1ce1289901ab1bed876ec9ec21eb144d9c52b6d,master,master,52b301019a4bd8cb6b56a3b51d3087cd71b66386,979da84674d28c21394afec4b8e8559aed85d4eb -github:GithubPullRequest:1:346931859,github:GithubRepo:1:134018330,,closed,Refine the indentation of the sample code in READMEs,"""""",https://github.com/panjf2000/ants/pull/66,RealLiuSha,github:GithubUser:1:5715152,,66,2019-11-29T07:50:17.000+00:00,,2019-11-29T07:52:04.000+00:00,,,1acafed7740d0daf1dcc3a30129798f59c234331,master,master,fd3841dd88c15fcc0e0ea94e606d980221ac5e09,b19edbd7b909527b2cc2a759e7a60133497f9dee -github:GithubPullRequest:1:379435034,github:GithubRepo:1:134018330,,closed,Fix a bug that doesn't release lock,"""err!=nil时未释放锁,使用defer p.lock.Unlock()修复\r\n\r\n---\r\nname: Pull request\r\nabout: Propose changes to the code\r\ntitle: ''\r\nlabels: ''\r\nassignees: ''\r\n---\r\n\r\n\r\n\r\n## 1. Are you opening this pull request for bug-fixs, optimizations or new feature?\r\n\r\n\r\n\r\n## 2. Please describe how these code changes achieve your intention.\r\n\r\n\r\n\r\n\r\n## 3. Please link to the relevant issues (if any).\r\n\r\n\r\n\r\n\r\n## 4. Which documentation changes (if any) need to be made/updated because of this PR?\r\n\r\n\r\n\r\n\r\n## 4. Checklist\r\n\r\n- [ ] I have squashed all insignificant commits.\r\n- [ ] I have commented my code for explaining package types, values, functions, and non-obvious lines.\r\n- [ ] I have written unit tests and verified that all tests passes (if needed).\r\n- [ ] I have documented feature info on the README (only when this PR is adding a new feature).\r\n- [x] (optional) I am willing to help maintain this change if there are issues with it later.\r\n""",https://github.com/panjf2000/ants/pull/79,lam2003,github:GithubUser:1:22312935,,79,2020-02-25T08:30:05.000+00:00,2020-02-26T03:15:03.000+00:00,2020-02-26T03:15:03.000+00:00,,,d8cb0361988bf8a0a2a5bee93a06f9c4e1b65e61,master,master,c3b448271b0f84fd3e850b679bf29e7965fe7608,e7a2d3706bf4d32f0e927258b10d2a3585b9ed7d -github:GithubPullRequest:1:404931293,github:GithubRepo:1:134018330,,closed,fix:v2 dir not exist,"""---\r\nname: Pull request\r\nabout: Propose changes to the code\r\ntitle: ''\r\nlabels: ''\r\nassignees: ''\r\n---\r\n\r\n\r\n\r\n## 1. Are you opening this pull request for bug-fixs, optimizations or new feature?\r\n\r\nbug-fix\r\n\r\n## 2. Please describe how these code changes achieve your intention.\r\n\r\nI need to use this repo, but it has errors. \r\nThere is a internal dir, but no v2/internal and v2/internal is used in repo. i just added a new v2/internal dir copied from internal dir.\r\n\r\n\r\n\r\n## 3. Please link to the relevant issues (if any).\r\n\r\n\r\n\r\n\r\n## 4. Which documentation changes (if any) need to be made/updated because of this PR?\r\n\r\n\r\n\r\n\r\n## 4. Checklist\r\n\r\n- [ ] I have squashed all insignificant commits.\r\n- [ ] I have commented my code for explaining package types, values, functions, and non-obvious lines.\r\n- [ ] I have written unit tests and verified that all tests passes (if needed).\r\n- [ ] I have documented feature info on the README (only when this PR is adding a new feature).\r\n- [ ] (optional) I am willing to help maintain this change if there are issues with it later.\r\n""",https://github.com/panjf2000/ants/pull/87,shanghai-Jerry,github:GithubUser:1:12420699,,87,2020-04-17T05:34:28.000+00:00,,2020-04-19T03:03:07.000+00:00,,,010ef635a955c8ab81620e78099440311f273111,master,master,f33679bb799fe76b52d47d3172c40ce229463198,402dcefd038c7db892b3c433d1d93e09a3e48652 -github:GithubPullRequest:1:410487606,github:GithubRepo:1:134018330,,closed,Fix indent on README,"""---\r\nname: Pull request\r\nabout: Propose changes to the code\r\ntitle: 'Fix indent'\r\nlabels: ''\r\nassignees: ''\r\n---\r\n\r\n\r\n\r\n## 1. Are you opening this pull request for bug-fixs, optimizations or new feature?\r\n\r\nNo.\r\n\r\n## 2. Please describe how these code changes achieve your intention.\r\n\r\n\r\nThere are wrong idents on README.md.\r\n\r\n## 3. Please link to the relevant issues (if any).\r\n\r\n\r\n\r\n\r\n## 4. Which documentation changes (if any) need to be made/updated because of this PR?\r\n\r\n\r\n\r\n\r\n## 4. Checklist\r\n\r\n- [x] I have squashed all insignificant commits.\r\n- [ ] I have commented my code for explaining package types, values, functions, and non-obvious lines.\r\n- [ ] I have written unit tests and verified that all tests passes (if needed).\r\n- [ ] I have documented feature info on the README (only when this PR is adding a new feature).\r\n- [ ] (optional) I am willing to help maintain this change if there are issues with it later.\r\n""",https://github.com/panjf2000/ants/pull/89,wreulicke,github:GithubUser:1:12907474,,89,2020-04-29T04:51:26.000+00:00,2020-04-29T07:08:43.000+00:00,2020-04-29T07:08:43.000+00:00,,,88b5a85d64e3aa487f157dc6266472a7a14eeb0d,patch-1,master,f33679bb799fe76b52d47d3172c40ce229463198,51f1f518835109c3de3cfa42bf29a01cc5fcd788 -github:GithubPullRequest:1:415925259,github:GithubRepo:1:134018330,,closed,支持配置workerChanCap大小,"""---\r\nname: Pull request\r\nabout: support customize workerChanCap \r\ntitle: ''\r\nlabels: ''\r\nassignees: ''\r\n---\r\n\r\n\r\n\r\n## 1. Are you opening this pull request for bug-fixs, optimizations or new feature?\r\n\r\n\r\n\r\n## 2. Please describe how these code changes achieve your intention.\r\n\r\n\r\n\r\n\r\n## 3. Please link to the relevant issues (if any).\r\n\r\n\r\n\r\n\r\n## 4. Which documentation changes (if any) need to be made/updated because of this PR?\r\n\r\n\r\n\r\n\r\n## 4. Checklist\r\n\r\n- [x] I have squashed all insignificant commits.\r\n- [x] I have commented my code for explaining package types, values, functions, and non-obvious lines.\r\n- [ ] I have written unit tests and verified that all tests passes (if needed).\r\n- [ ] I have documented feature info on the README (only when this PR is adding a new feature).\r\n- [ ] (optional) I am willing to help maintain this change if there are issues with it later.\r\n""",https://github.com/panjf2000/ants/pull/91,lntotk,github:GithubUser:1:5227289,,91,2020-05-11T07:40:41.000+00:00,,2020-05-11T09:27:30.000+00:00,,,ff938265a22ac26c4a2ff7ee0f696cf4fe9e3895,master,master,1c534853c887e0a7b0d56d51303bf09f201e26a0,b1ce6e8fb4f31b4d75b748bbe2d03c28e0f737f2 -github:GithubPullRequest:1:452382525,github:GithubRepo:1:134018330,,closed,chore: support go1.14,"""as title.""",https://github.com/panjf2000/ants/pull/100,appleboy,github:GithubUser:1:21979,,100,2020-07-19T06:38:38.000+00:00,2020-07-19T14:59:48.000+00:00,2020-07-19T14:59:48.000+00:00,,,0a7be73d35726850863a80432dec0ac5c78cdfb4,patch,master,b2666199751ef4fe666c175ba667d18a182b67e0,18623ceb17a9230484ff5d1a31c3beb0b631a2f3 -github:GithubPullRequest:1:461992435,github:GithubRepo:1:134018330,,closed,Add a Gitter chat badge to README.md,"""### panjf2000/ants now has a Chat Room on Gitter\n\n@panjf2000 has just created a chat room. You can visit it here: [https://gitter.im/ants-pool/ants](https://gitter.im/ants-pool/ants?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&content=body_link).\n\nThis pull-request adds this badge to your README.md:\n\n\n[![Gitter](https://badges.gitter.im/ants-pool/ants.svg)](https://gitter.im/ants-pool/ants?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=body_badge)\n\nIf my aim is a little off, please [let me know](https://gitlab.com/gitlab-org/gitter/readme-badger/issues).\n\nHappy chatting.\n\n\nPS: [Click here](https://gitter.im/settings/badger/opt-out) if you would prefer not to receive automatic pull-requests from Gitter in future.\n""",https://github.com/panjf2000/ants/pull/103,gitter-badger,github:GithubUser:1:8518239,,103,2020-08-03T07:12:25.000+00:00,,2020-08-03T07:17:52.000+00:00,,,acb7f9847897513820e2467ef9720cb213a97133,gitter-badge,master,c32db55d3e7e19d8300760de03584072b6a9de93,f323aef64aa8b47b777037502adf6eca0b2f4fd0 -github:GithubPullRequest:1:475457581,github:GithubRepo:1:134018330,,closed,Avoid memory leak,"""---\r\nname: Pull request\r\nabout: Propose changes to the code\r\ntitle: 'avoid memory leaky'\r\nlabels: 'gc'\r\nassignees: ''\r\n---\r\n\r\n\r\n\r\n## 1. Are you opening this pull request for bug-fixs, optimizations or new feature?\r\n bug fix\r\n\r\n\r\n## 2. Please describe how these code changes achieve your intention.\r\n\r\n 我认为在对stack,loop queue在出栈或出队需要对不使用的切片元素进行置为nil操作,因为是指针,不应该留在未使用的切片位置,在突发任务需要goroutine时,会分配大量的goWorker并进入工作,但是当没有突发任务时,这些都在空闲队列或队列中是没有回收的,但是当超过存活时间,进行回收时,还是有底层的数据持有(未置为nil),个人认为会占有大量的内存,这部份应该真正的交还给sync.Pool.\r\n 另外,假设在sync.Pool和切片底层数组同时持有同一个对象,不知道go的gc是什么行为? \r\n\r\n## 3. Please link to the relevant issues (if any).\r\n\r\n\r\n\r\n\r\n## 4. Which documentation changes (if any) need to be made/updated because of this PR?\r\n\r\n\r\n\r\n\r\n## 4. Checklist\r\n\r\n- [x] I have squashed all insignificant commits.\r\n- [ ] I have commented my code for explaining package types, values, functions, and non-obvious lines.\r\n- [ ] I have written unit tests and verified that all tests passes (if needed).\r\n- [ ] I have documented feature info on the README (only when this PR is adding a new feature).\r\n- [x] (optional) I am willing to help maintain this change if there are issues with it later.\r\n""",https://github.com/panjf2000/ants/pull/107,thinkgos,github:GithubUser:1:49174849,,107,2020-08-28T15:02:33.000+00:00,2020-08-29T10:51:57.000+00:00,2020-08-29T10:51:57.000+00:00,,,ef6017217221e20416d886c0231dd5134752ef4e,master,master,21f632368adbd3b3af71038ab697a6585a40db62,e2ccffc1650009dcf72cf93dbe95888abfba63eb -github:GithubPullRequest:1:496172205,github:GithubRepo:1:134018330,,closed,Remove underscore from file names,"""\r\n## 1. Are you opening this pull request for bug-fixes, optimizations, or new features?\r\nFixing the file naming convention based on [this](https://golang.org/doc/effective_go.html#package-names).\r\n\r\n## 2. Please describe how these code changes achieve your intention.\r\nThere is no code change\r\n\r\n\r\n\r\n_(Feel free to reject this PR if you think it's unnecessary)_""",https://github.com/panjf2000/ants/pull/111,arjunmahishi,github:GithubUser:1:11977524,,111,2020-10-01T11:08:20.000+00:00,,2020-10-04T07:42:53.000+00:00,,,21ae8e46646bff4ef8804892b5d2f064b0772efc,fix/file-naming-convention,master,ef6017217221e20416d886c0231dd5134752ef4e,7403b395ea8e1a39ca7a2f29aee7b4735cb988ef -github:GithubPullRequest:1:502102437,github:GithubRepo:1:134018330,,closed,fix: Memory leak,"""Fixes #113""",https://github.com/panjf2000/ants/pull/114,Mutated1994,github:GithubUser:1:29589055,,114,2020-10-13T08:37:37.000+00:00,2020-10-15T03:35:56.000+00:00,2020-10-15T03:35:56.000+00:00,,,94a7a7f1cb3a11fcaaf9608c94fe1dc0bcd98ab0,master,master,ef6017217221e20416d886c0231dd5134752ef4e,00691c648a5b7d28dba5bcafa05d9bbccdf4d933 -github:GithubPullRequest:1:505486248,github:GithubRepo:1:134018330,,closed,fix set negative size,"""fix set negative size for pool\r\n""",https://github.com/panjf2000/ants/pull/117,imxyb,github:GithubUser:1:7411249,,117,2020-10-18T14:58:12.000+00:00,,2020-10-19T01:58:45.000+00:00,,,55d7f5eb6298d59b76a26b56d1bbb776503a8563,hotfix-poolsize,master,94a7a7f1cb3a11fcaaf9608c94fe1dc0bcd98ab0,05a3664dbf966f1a7ced274aaf47d34e644287ef -github:GithubPullRequest:1:543900177,github:GithubRepo:1:134018330,,closed,Add go1.15.x support on CI,"""Add go1.15.x support on CI""",https://github.com/panjf2000/ants/pull/131,kaiiak,github:GithubUser:1:2832687,,131,2020-12-22T06:25:18.000+00:00,,2021-03-19T02:15:23.000+00:00,,,545d5f0c007d1d5e2cd23ae2d9074365c0f03790,patch-1,master,fd8d670fd09489e6ea7693c0a382ba85d2694f16,15cb2705734c62544ac5dca0de3f28f03a69a854 -github:GithubPullRequest:1:582870188,github:GithubRepo:1:134018330,,closed,Change the writing of if...err,"""---\r\nname: Pull request\r\nabout: Propose changes to the code\r\ntitle: ''\r\nlabels: ''\r\nassignees: ''\r\n---\r\n\r\n\r\n\r\n## 1. Are you opening this pull request for bug-fixs, optimizations or new feature?\r\n\r\n\r\n\r\n## 2. Please describe how these code changes achieve your intention.\r\n\r\n\r\n\r\n\r\n## 3. Please link to the relevant issues (if any).\r\n\r\n\r\n\r\n\r\n## 4. Which documentation changes (if any) need to be made/updated because of this PR?\r\n\r\n\r\n\r\n\r\n## 4. Checklist\r\n\r\n- [x] I have squashed all insignificant commits.\r\n- [x] I have commented my code for explaining package types, values, functions, and non-obvious lines.\r\n- [x] I have written unit tests and verified that all tests passes (if needed).\r\n- [x] I have documented feature info on the README (only when this PR is adding a new feature).\r\n- [x] (optional) I am willing to help maintain this change if there are issues with it later.\r\n""",https://github.com/panjf2000/ants/pull/136,Comolli,github:GithubUser:1:47921612,,136,2021-03-02T09:24:36.000+00:00,,2021-03-11T02:27:15.000+00:00,,,ed97c442167956de4aa11495a37f2557edebd904,master,master,fd8d670fd09489e6ea7693c0a382ba85d2694f16,5431f73492ade2e5b947a98f6032595c32cf730e -github:GithubPullRequest:1:586207150,github:GithubRepo:1:134018330,,closed,The program should return directly when the pool size passed in when …,"""…calling the NewPool interface is less than or equal to 0\r\n\r\n---\r\nname: Pull request\r\nabout: Propose changes to the code\r\ntitle: 'code improve'\r\n---\r\n""",https://github.com/panjf2000/ants/pull/139,zhangyuanxue,github:GithubUser:1:32893410,,139,2021-03-07T08:00:46.000+00:00,,2021-03-12T12:45:57.000+00:00,,,9a4288b9368ab4551d967fddda163d6be2182fde,feature/zhangyuanxue/dev,master,fd8d670fd09489e6ea7693c0a382ba85d2694f16,ba4160c5fd41151ebbd50cb786c5ce21711b5a7b -github:GithubPullRequest:1:607755003,github:GithubRepo:1:134018330,,closed,pool_list,"""sequence""",https://github.com/panjf2000/ants/pull/149,yddeng,github:GithubUser:1:41562937,,149,2021-04-02T01:16:21.000+00:00,,2021-04-02T04:09:52.000+00:00,,,fd1b0378ee9b60fe32a2fe5c8198a427e5f46949,pool_list,master,dbcb6a104f23b1a6a7521796b30515230353283e,674fe08bb2c2ced275600ebdddf2412c84e2c349 -github:GithubPullRequest:1:654684379,github:GithubRepo:1:134018330,,open,Submit a task with args to pool,"""---\r\nname: Resolve problem with args capturing\r\n---\r\n\r\n\r\n\r\n## 1. Are you opening this pull request for bug-fixs, optimizations or new feature?\r\nNew feature.\r\n\r\n\r\n## 2. Please describe how these code changes achieve your intention.\r\n\r\nSometimes, we need to call go-routines with args, but by default we have problem - wrong args capturing. And pool has the same problem. This PR resolves this problem.\r\n\r\n\r\n## 3. Please link to the relevant issues (if any).\r\n\r\n\r\n\r\n\r\n## 4. Which documentation changes (if any) need to be made/updated because of this PR?\r\n\r\n\r\n\r\n\r\n## 4. Checklist\r\n\r\n- [x] I have squashed all insignificant commits.\r\n- [x] I have commented my code for explaining package types, values, functions, and non-obvious lines.\r\n- [x] I have written unit tests and verified that all tests passes (if needed).\r\n- [x] I have documented feature info on the README (only when this PR is adding a new feature).\r\n- [ ] (optional) I am willing to help maintain this change if there are issues with it later.\r\n""",https://github.com/panjf2000/ants/pull/158,icecube092,github:GithubUser:1:58211133,,158,2021-05-27T08:53:42.000+00:00,,,,,077334b198b9af2322e214675bb4fcb62b0a7c0c,args_capture,master,134f354e8e3ba73a35bc7da671ea6d1a8001d35d,2dd731d5897d50508e9d262cf64a8f4807f0f42f -github:GithubPullRequest:1:669972849,github:GithubRepo:1:134018330,,open,allow NewPoolWithFunc can invoke with nil argument,"""2. abstract a Task interface for SubmitTask which is more convenient\r\n\r\n---\r\nname: Pull request\r\nabout: Propose changes to the code\r\ntitle: 'allow NewPoolWithFunc can invoke with nil argument'\r\nlabels: ''\r\nassignees: ''\r\n---\r\n\r\n\r\n\r\n## 1. Are you opening this pull request for bug-fixs, optimizations or new feature?\r\n\r\noptimizations\r\n\r\n\r\n## 2. Please describe how these code changes achieve your intention.\r\n\r\n\r\n1. allow NewPoolWithFunc can invoke with nil argument\r\n2. abstract a Task interface for SubmitTask which is more convenient\r\n\r\n## 3. Please link to the relevant issues (if any).\r\nnone\r\n\r\n## 4. Which documentation changes (if any) need to be made/updated because of this PR?\r\n\r\nnone\r\n\r\n\r\n## 4. Checklist\r\n\r\n- [x] I have squashed all insignificant commits.\r\n- [ ] I have commented my code for explaining package types, values, functions, and non-obvious lines.\r\n- [x] I have written unit tests and verified that all tests passes (if needed).\r\n- [ ] I have documented feature info on the README (only when this PR is adding a new feature).\r\n- [ ] (optional) I am willing to help maintain this change if there are issues with it later.\r\n""",https://github.com/panjf2000/ants/pull/167,bingoohuang,github:GithubUser:1:1940588,,167,2021-06-15T00:57:34.000+00:00,,,,,eb924ade19ae94cc8f85cab39a71f6afa56fdef3,master,master,134f354e8e3ba73a35bc7da671ea6d1a8001d35d,9915f61140287a2f768fcaf71f6d5bd6454521c9 -github:GithubPullRequest:1:686947632,github:GithubRepo:1:134018330,,closed,Timing issue in the TestNonblockingSubmitWithFunc,"""On some machines this unit would fail due to a timing issue. Since the Invoke in the loop was using nil as the param, it would (depending on timing) lead to the workers finishing the (w *goWorkerWithFunc) run() in the range loop over w.args as args would == nil and return. \r\n\r\nIf an explicit time.Sleep(1 * time.Second) is added before the \""\tassert.EqualError(t, p.Invoke(nil), ErrPoolOverload.Error(),\"" it is easily reproducible.\r\n\r\n---\r\nname: Pull request\r\nabout: Propose changes to the code\r\ntitle: ''\r\nlabels: ''\r\nassignees: ''\r\n---\r\n\r\n\r\n\r\n## 1. Are you opening this pull request for bug-fixs, optimizations or new feature?\r\n\r\nbug-fix\r\n\r\n## 2. Please describe how these code changes achieve your intention.\r\n\r\n\r\nstated above\r\n\r\n## 3. Please link to the relevant issues (if any).\r\n\r\n\r\nn/a\r\n\r\n## 4. Which documentation changes (if any) need to be made/updated because of this PR?\r\n\r\n\r\nn/a\r\n\r\n## 4. Checklist\r\n\r\n- [x] I have squashed all insignificant commits.\r\n- [x] I have commented my code for explaining package types, values, functions, and non-obvious lines.\r\n- [x] I have written unit tests and verified that all tests passes (if needed).\r\n- [x] I have documented feature info on the README (only when this PR is adding a new feature).\r\n- [x] (optional) I am willing to help maintain this change if there are issues with it later.\r\n""",https://github.com/panjf2000/ants/pull/172,jdamick,github:GithubUser:1:12317,,172,2021-07-09T17:43:56.000+00:00,2021-07-12T14:52:47.000+00:00,2021-07-12T14:52:47.000+00:00,,,63489606efd8498bdd76c375b2913e7decaa1e63,patch-1,master,4b16a811165326723182488f21b22ea6761418f4,57eb78708675c067aeadad224f0ce57a53edc248 -github:GithubPullRequest:1:693963625,github:GithubRepo:1:134018330,,closed,Fix CI workflow to make the cache action really work,"""workflows add cache mod file\r\nworkflows should be restore cache before unit test\r\nlink [actions/cache](https://github.com/marketplace/actions/cache)\r\n---\r\nname: Pull request\r\nabout: Propose changes to the code\r\ntitle: 'workflows'\r\nlabels: 'workflows'\r\nassignees: ''\r\n---\r\n\r\n## 1. Are you opening this pull request for bug-fixs, optimizations or new feature?\r\n fix workflows\r\n## 2. Please describe how these code changes achieve your intention.\r\n no\r\n## 3. Please link to the relevant issues (if any).\r\n no\r\n## 4. Which documentation changes (if any) need to be made/updated because of this PR?\r\n no\r\n\r\n## 4. Checklist\r\n\r\n- [x] I have squashed all insignificant commits.\r\n- [x] I have commented my code for explaining package types, values, functions, and non-obvious lines.\r\n- [x] I have written unit tests and verified that all tests passes (if needed).\r\n- [x] I have documented feature info on the README (only when this PR is adding a new feature).\r\n- [x] (optional) I am willing to help maintain this change if there are issues with it later.\r\n""",https://github.com/panjf2000/ants/pull/174,thinkgos,github:GithubUser:1:49174849,,174,2021-07-21T00:56:19.000+00:00,2021-07-21T03:21:49.000+00:00,2021-07-21T03:21:49.000+00:00,,,cfb27797a83ff7ea787acf1c6627657ac174dca3,master,master,63489606efd8498bdd76c375b2913e7decaa1e63,1a658c033be78d2dea8db57c166ee4ba3ad951f7 -github:GithubPullRequest:1:696437287,github:GithubRepo:1:134018330,,open,feat: goroutine exits immediately,"""---\r\nname: goroutine exits immediately\r\nabout: goroutine exits immediately, lazy init defaultAntsPool\r\ntitle: 'goroutine exits immediately'\r\nlabels: ''\r\nassignees: 'panjf2000'\r\n---\r\n\r\n\r\n\r\n## 1. Are you opening this pull request for bug-fixs, optimizations or new feature?\r\n\r\noptimizations\r\n\r\nFirst of all, thanks to ants for maintaining a good pool implementation. In the process of using it, it was found that some goroutines did not exit when Release was called. This mr change will cause all goroutines to exit immediately.\r\nExcept for the first time, the global defaultAntsPool will be created by default. In this mr, defaultAntsPool will be created the first time it is called.\r\n\r\n## 2. Please describe how these code changes achieve your intention.\r\n\r\n\r\nTODO\r\n\r\n## 3. Please link to the relevant issues (if any).\r\n\r\n\r\nTODO\r\n\r\n## 4. Which documentation changes (if any) need to be made/updated because of this PR?\r\n\r\n\r\nTODO\r\n\r\n## 4. Checklist\r\n\r\n- [x] I have squashed all insignificant commits.\r\n- [x] I have commented my code for explaining package types, values, functions, and non-obvious lines.\r\n- [x] I have written unit tests and verified that all tests passes (if needed).\r\n- [x] I have documented feature info on the README (only when this PR is adding a new feature).\r\n""",https://github.com/panjf2000/ants/pull/176,exfly,github:GithubUser:1:22613193,,176,2021-07-25T03:44:37.000+00:00,,,,,caecc9821c7f6f304bd2325bcb200b69f0489210,feat-goroutine-exits-immediately,master,134f354e8e3ba73a35bc7da671ea6d1a8001d35d,12dd0eaff299e7425062bab820801494355e025b -github:GithubPullRequest:1:731946063,github:GithubRepo:1:134018330,,closed,style: fixed some typos in the comments,"""---\r\nname: Pull request\r\nabout: typos in comments\r\ntitle: fixed some typos in the comments\r\nlabels: \r\nassignees: @panjf2000 \r\n---\r\n\r\n\r\n\r\n## 1. Are you opening this pull request for bug-fixs, optimizations or new feature?\r\n\r\nfixed some typos only for comments\r\n\r\n## 2. Please describe how these code changes achieve your intention.\r\n\r\n\r\nfixed some typos only for comments\r\n\r\n## 3. Please link to the relevant issues (if any).\r\n\r\n\r\nno issues related\r\n\r\n## 4. Which documentation changes (if any) need to be made/updated because of this PR?\r\n\r\n\r\nno need for docs change\r\n\r\n## 4. Checklist\r\n\r\n- [x] I have squashed all insignificant commits.\r\n- [x] I have commented my code for explaining package types, values, functions, and non-obvious lines.\r\n- [ ] I have written unit tests and verified that all tests passes (if needed).\r\n- [ ] I have documented feature info on the README (only when this PR is adding a new feature).\r\n- [x] (optional) I am willing to help maintain this change if there are issues with it later.\r\n""",https://github.com/panjf2000/ants/pull/184,automano,github:GithubUser:1:17286982,,184,2021-09-11T15:06:25.000+00:00,2021-09-13T03:57:25.000+00:00,2021-09-13T03:57:25.000+00:00,,,f62e8ab1e0a951ab278ac794979b27ebd89ab0b5,master,master,6de43fdfb9f358a7552f05d0989710dd89380236,2201960d862462743cc1c9da0ca0911d905f25d3 -github:GithubPullRequest:1:736936308,github:GithubRepo:1:134018330,,closed,Update the link of one of the relevant articles,"""Hello! I never got the chance to mention it before, but thank you for linking one of my articles in your repository :) \r\n\r\n## 1. Are you opening this pull request for bug-fixs, optimizations or new feature?\r\nNo\r\n\r\n\r\n## 2. Please describe how these code changes achieve your intention.\r\nI'm working on migrating my domain from `twinnation.org` to `twin.sh`, thus I'm preemptively updating the link to prevent it from becoming dead at some point\r\n\r\n\r\n## 3. Please link to the relevant issues (if any).\r\nN/A\r\n\r\n\r\n## 4. Which documentation changes (if any) need to be made/updated because of this PR?\r\nN/A\r\n\r\n\r\n## 5. Checklist\r\n\r\n- [X] I have squashed all insignificant commits.\r\n- [X] I have commented my code for explaining package types, values, functions, and non-obvious lines.\r\n- [X] I have written unit tests and verified that all tests passes (if needed).\r\n- [X] I have documented feature info on the README (only when this PR is adding a new feature).\r\n- [X] (optional) I am willing to help maintain this change if there are issues with it later.\r\n""",https://github.com/panjf2000/ants/pull/185,TwiN,github:GithubUser:1:15699766,,185,2021-09-18T17:06:03.000+00:00,2021-09-19T02:56:40.000+00:00,2021-09-19T02:56:40.000+00:00,,,61d120b6f086998184f402a83ace485a036d4c7d,patch-1,master,f62e8ab1e0a951ab278ac794979b27ebd89ab0b5,71fd3a37d0df59cf1e73fa1272ecd92bab11a7c1 -github:GithubPullRequest:1:742901118,github:GithubRepo:1:134018330,,closed,Update the link of one of the relevant articles,"""re: #185\r\n\r\nMissed the `README_ZH.md` file 😅 """,https://github.com/panjf2000/ants/pull/186,TwiN,github:GithubUser:1:15699766,,186,2021-09-26T15:53:39.000+00:00,2021-09-27T02:38:55.000+00:00,2021-09-27T02:38:55.000+00:00,,,3f9c4cd54898e7149c7f6d072213b8fdbd0036d8,patch-1,master,61d120b6f086998184f402a83ace485a036d4c7d,41f6b572b25da6363d7d7c45b77705fd8bee7466 -github:GithubPullRequest:1:757412327,github:GithubRepo:1:134018330,,closed,add shopify into user cases,"""Fixes https://github.com/panjf2000/ants/issues/188""",https://github.com/panjf2000/ants/pull/189,lilien1010,github:GithubUser:1:3814966,,189,2021-10-13T13:34:05.000+00:00,2021-10-13T13:42:42.000+00:00,2021-10-13T13:42:42.000+00:00,,,76ce0ce24f21b1dd13050e0c84b07ce55e68f111,add-shopify-as-user-case,master,3f9c4cd54898e7149c7f6d072213b8fdbd0036d8,efe0bad6c0ab13b54d00909864e34a1060e41d6e -github:GithubPullRequest:1:763816683,github:GithubRepo:1:134018330,,closed,add more test about spinlock,"""---\r\nname: Pull request\r\nabout: add more test about spinlock\r\ntitle: ''\r\nlabels: ''\r\nassignees: ''\r\n---\r\n\r\n\r\n\r\n## 1. Are you opening this pull request for bug-fixs, optimizations or new feature?\r\n just add more test about spinlock\r\n\r\n\r\n## 2. Please describe how these code changes achieve your intention.\r\n\r\n \r\nSimulate the performance comparison of spinlock with and without backoff and mutex in different scenarios\r\n\r\n\r\n## 3. Please link to the relevant issues (if any).\r\n\r\nFixes #191 \r\n\r\n\r\n## 4. Which documentation changes (if any) need to be made/updated because of this PR?\r\n\r\n\r\n\r\n\r\n## 4. Checklist\r\n\r\n- [x] I have squashed all insignificant commits.\r\n- [x] I have commented my code for explaining package types, values, functions, and non-obvious lines.\r\n- [x] I have written unit tests and verified that all tests passes (if needed).\r\n- [ ] I have documented feature info on the README (only when this PR is adding a new feature).\r\n- [x] I (optional) I am willing to help maintain this change if there are issues with it later.\r\n""",https://github.com/panjf2000/ants/pull/192,liu-song,github:GithubUser:1:22676124,,192,2021-10-22T02:53:44.000+00:00,,2021-11-27T13:44:28.000+00:00,,,74520b109f893c8e4a85e6a4b8cad96dcddc8d94,master,master,d3e3a334a3b1a5b80e75b296ebd84fe89f5edec0,d16a241d2624bf815159acf091d6f62e663af999 -github:GithubPullRequest:1:770998086,github:GithubRepo:1:134018330,,closed,Replace goto with simple for loop,"""---\r\nname: Pull request\r\nabout: Replace goto with simple for loop\r\ntitle: 'Replace goto with simple for loop'\r\nlabels: ''\r\nassignees: ''\r\n---\r\n\r\n\r\n\r\n## 1. Are you opening this pull request for bug-fixs, optimizations or new feature?\r\n\r\noptimizations\r\n\r\n## 2. Please describe how these code changes achieve your intention.\r\n\r\n\r\nReplace goto with simple for loop\r\n\r\n## 3. Please link to the relevant issues (if any).\r\n\r\n\r\nnone\r\n\r\n## 4. Which documentation changes (if any) need to be made/updated because of this PR?\r\n\r\n\r\nnone\r\n\r\n## 4. Checklist\r\n\r\n- [x] I have squashed all insignificant commits.\r\n- [x] I have commented my code for explaining package types, values, functions, and non-obvious lines.\r\n- [x] I have written unit tests and verified that all tests passes (if needed).\r\n- [x] I have documented feature info on the README (only when this PR is adding a new feature).\r\n- [x] (optional) I am willing to help maintain this change if there are issues with it later.\r\n""",https://github.com/panjf2000/ants/pull/193,lord63,github:GithubUser:1:5268051,,193,2021-11-02T00:36:11.000+00:00,,2021-11-18T14:44:40.000+00:00,,,46126780142e06608ca4c49572160365f8f92282,drop-goto-usage-with-for,master,76ce0ce24f21b1dd13050e0c84b07ce55e68f111,676e5c84e4da504bb4577e1af0b37b7c82cc52ad -github:GithubPullRequest:1:791490205,github:GithubRepo:1:134018330,,closed,optimize: calculating mid in binary search,"""---\r\nname: Pull request\r\nabout: Propose changes to the code\r\ntitle: ''\r\nlabels: ''\r\nassignees: ''\r\n---\r\n\r\n\r\n\r\n## 1. Are you opening this pull request for bug-fixs, optimizations or new feature?\r\n\r\nOptimization.\r\n\r\n## 2. Please describe how these code changes achieve your intention.\r\n\r\n\r\nTo avoid calculating mid overflow, see [stackoverflow](https://stackoverflow.com/questions/6735259/calculating-mid-in-binary-search) discussion.\r\n\r\n## 3. Please link to the relevant issues (if any).\r\n\r\n\r\n\r\n\r\n## 4. Which documentation changes (if any) need to be made/updated because of this PR?\r\n\r\n\r\n\r\n\r\n## 4. Checklist\r\n\r\n- [x] I have squashed all insignificant commits.\r\n- [ ] I have commented my code for explaining package types, values, functions, and non-obvious lines.\r\n- [ ] I have written unit tests and verified that all tests passes (if needed).\r\n- [ ] I have documented feature info on the README (only when this PR is adding a new feature).\r\n- [ ] (optional) I am willing to help maintain this change if there are issues with it later.\r\n""",https://github.com/panjf2000/ants/pull/198,qmdx00,github:GithubUser:1:27898261,,198,2021-11-30T09:34:02.000+00:00,,2021-12-01T00:42:16.000+00:00,,,0a67f19748a39459ab7b84e0bb89d9314e751433,optimize-calculating-mid,master,1e897421860606afc3d1304cafe5cd187cee13e9,c038cb6a3fdb41292378e91098b5badff5adb8f4 -github:GithubPullRequest:1:816835878,github:GithubRepo:1:134018330,,closed,Add binarysearch of loop queue,"""---\r\nname: Pull request\r\nabout: Add binarysearch method to loop_queue to get expired workers, just like worker_stack.\r\ntitle: ''\r\nlabels: ''\r\nassignees: 'bright2227'\r\n---\r\n\r\n\r\n\r\n## 1. Are you opening this pull request for bug-fixs, optimizations or new feature?\r\noptimizations \r\n\r\n\r\n\r\n## 2. Please describe how these code changes achieve your intention.\r\nI found that loop_queue had an intention to use binarysearch method, just like worker_stack. But it's removed before being merged into the master branch due to some bugs. I mapped true positions to imaginary positions before using binarysearch method and also add some tests to make sure it works.\r\n\r\n\r\n## 3. Please link to the relevant issues (if any).\r\nhttps://github.com/panjf2000/ants/pull/53#pullrequestreview-299506068\r\n\r\n\r\n## 4. Which documentation changes (if any) need to be made/updated because of this PR?\r\nNo need.\r\n\r\n\r\n\r\n## 4. Checklist\r\n\r\n- [ ] I have squashed all insignificant commits.\r\n- [x] I have commented my code for explaining package types, values, functions, and non-obvious lines.\r\n- [x] I have written unit tests and verified that all tests passes (if needed).\r\n- [ ] I have documented feature info on the README (only when this PR is adding a new feature).\r\n- [x] (optional) I am willing to help maintain this change if there are issues with it later.\r\n""",https://github.com/panjf2000/ants/pull/206,bright2227,github:GithubUser:1:64823610,,206,2022-01-08T10:06:36.000+00:00,2022-01-31T02:49:03.000+00:00,2022-01-31T02:49:03.000+00:00,,,1bd4304727b2ea62ec243f3145389d6ffe3607cf,add_binarysearch_of_loop_q,master,1e897421860606afc3d1304cafe5cd187cee13e9,1b95a084ac08cd34e247b5d3d0063778cfc14748 -github:GithubPullRequest:1:835038436,github:GithubRepo:1:134018330,,closed,Awake the blocking callers when Tune(size int) is invoked to expand the pool,"""…capacity\r\n\r\n---\r\nname: Pull request\r\nabout: Propose changes to the code\r\ntitle: 'Instantly scale up capacity when using Tune(size int) to enlarge the capacity'\r\nlabels: 'enhancement'\r\nassignees: ''\r\n---\r\n\r\n\r\n\r\n## 1. Are you opening this pull request for bug-fixs, optimizations or new feature?\r\n\r\nWhen using Tune(size int) to enlarge the capacity, create a worker immediately to perform blocking tasks.\r\n\r\n## 2. Please describe how these code changes achieve your intention.\r\n\r\n\r\n\r\n\r\n## 3. Please link to the relevant issues (if any).\r\n\r\n\r\nclose #205 \r\n\r\n\r\n## 4. Which documentation changes (if any) need to be made/updated because of this PR?\r\n\r\n\r\n\r\n\r\n## 4. Checklist\r\n\r\n- [x] I have squashed all insignificant commits.\r\n- [x] I have commented my code for explaining package types, values, functions, and non-obvious lines.\r\n- [x] I have written unit tests and verified that all tests passes (if needed).\r\n- [ ] I have documented feature info on the README (only when this PR is adding a new feature).\r\n- [x] (optional) I am willing to help maintain this change if there are issues with it later.\r\n""",https://github.com/panjf2000/ants/pull/210,codingfanlt,github:GithubUser:1:35493957,,210,2022-01-29T08:01:24.000+00:00,2022-02-14T13:51:40.000+00:00,2022-02-14T13:51:41.000+00:00,,,fbd17036dbf5ae677ba9e41326745a65e655232f,feat/instantly-scale-up-capacity,master,0fa2fd6dc1811f81026a252854f4a8c0471ac7b0,0e17530397bcec737dd9a77fc9589a6866ec4f6e -github:GithubPullRequest:1:842184289,github:GithubRepo:1:134018330,,open,Remove worker_func.go and modify pool_func.go simplifying the library,"""---\r\nname: Remove worker_func.go and modify pool_func.go simplifying the library\r\nabout: Remove worker_func.go and modify pool_func.go to simply utilize the non-func pool+worker implementation\r\ntitle: 'Remove worker_func.go and modify pool_func.go simplifying the library'\r\nlabels: ''\r\nassignees: @panjf2000 \r\n---\r\n\r\n\r\n\r\n## 1. Are you opening this pull request for bug-fixs, optimizations or new feature?\r\n\r\nSimplifying the library\r\n\r\n## 2. Please describe how these code changes achieve your intention.\r\n\r\n\r\nWhile reading through the library it became clear to me that `PoolWithFunc` was just a specific case of `Pool`, where instead of submitting tasks, the caller simply passes arguments for a pre-defined function to be run on the workers. This means that, instead of a `chan func() interface{}` as the message queue, we use a `chan interface{}`, and IMO this shouldn't warrant a completely different `Pool` implementation.\r\n\r\nThis PR proposes the complete removal of the `worker_func.go` file, choosing instead to adapt `PoolWithFunc` to use the default `Pool`, changing `.Invoke` to simply call the underlying `Pool.Submit` method with an anonymous function wrapping `p.poolFunc(args)`, transforming it into a `goWorker` accepted task, giving us a more robust and simpler library.\r\n\r\n## 3. Please link to the relevant issues (if any).\r\n\r\n\r\n## 4. Which documentation changes (if any) need to be made/updated because of this PR?\r\n\r\n\r\nNo documentation changes are needed as this doesn't change any of API or examples used.\r\n\r\n## 4. Checklist\r\n\r\n- [x] I have squashed all insignificant commits.\r\n- [x] I have commented my code for explaining package types, values, functions, and non-obvious lines.\r\n- [x] I have written unit tests and verified that all tests passes (if needed).\r\n- [x] (optional) I am willing to help maintain this change if there are issues with it later.\r\n- ~I have documented feature info on the README (only when this PR is adding a new feature).~\r\n""",https://github.com/panjf2000/ants/pull/211,lucafmarques,github:GithubUser:1:15234973,,211,2022-02-07T21:31:30.000+00:00,,,,,abc622e2696d0f5c1521c96dd206fc2a25c45ad4,simpler-pool-func,master,134f354e8e3ba73a35bc7da671ea6d1a8001d35d,863116682b4378fc82f00c950e5c6469c0e295bb +github:GithubPullRequest:1:203756736,github:GithubRepo:1:134018330,,closed,pre-allocate the capacity of the worker listpre-allocate the capacity of the worker listpre-allocate the capacity of the worker listpre-allocate the capacity of the worker listpre-allocate the capacity of the worker listpre-allocate the capacity of the worker listpre-allocate the capacity of the worker listpre-allocate the capacity of the worker listpre-allocate the capacity of the worker listpre-allocate the capacity of the worker listpre-allocate the capacity of the worker listpre-allocate the capacity of the worker listpre-allocate the capacity of the worker listpre-allocate the capacity of the worker listpre-allocate the capacity of the worker listpre-allocate the capacity of the worker listpre-allocate the capacity of the worker listpre-allocate the capacity of the worker listpre-allocate the capacity of the worker listpre-allocate the capacity of the worker listpre-allocate the capacity of the worker listpre-allocate the capacity of the worker listpre-allocate the capacity of the worker listpre-allocate the capacity of the worker listpre-allocate the capacity of the worker listpre-allocate the capacity of the worker listpre-allocate the capacity of the worker list,"""fix #3 \r\n* 链表实际测过, 性能相差无几, 但内存占用高了几倍\r\n* 初始化`Pool`和`PoolFunc`是给定了个默认的worker capacity\r\n* 优化了下其他代码""",https://github.com/panjf2000/ants/pull/4,barryz,github:GithubAccount:1:16658738,,4,2018-07-25T08:19:30.000+00:00,2018-07-26T02:32:41.000+00:00,2018-07-26T02:32:41.000+00:00,,,3ddd58c390b0f928a5782c235f90ad0c9c21312c,pre_allocate,master,f5b37d0798a8e4c6780a1e08270fa50e979aa1d7,83042d709562a53973c78901ca5df7e7cddbe677 +github:GithubPullRequest:1:211603583,github:GithubRepo:1:134018330,,closed,fix goroutine leak,"""n++, will cause workers[0] leak""",https://github.com/panjf2000/ants/pull/8,hongli-my,github:GithubAccount:1:8597823,,8,2018-08-29T01:35:54.000+00:00,,2018-10-30T00:12:13.000+00:00,,,74ba726f34abe487b7defac6bb9bebf24d342377,dev,master,666635c65d8d3bb1223b819325e0bd23c81f2733,afd687164b13280199208ec4869709edcf02b52d +github:GithubPullRequest:1:212277907,github:GithubRepo:1:134018330,,closed,Update pool.go,"""#活着的孩子不想当孤儿\r\n\tHopefully:\r\n\tchildren := []*child{C1,C2,C3,C4,C5,C6,C7}\r\n\tIn fact:\r\n\tchildren := []*child{C1,C4,C2,C3,C5,C6,C7}""",https://github.com/panjf2000/ants/pull/9,Nonnnnnnnnn,github:GithubAccount:1:42808204,,9,2018-08-31T05:29:36.000+00:00,,2018-08-31T13:40:33.000+00:00,,,f14d3f91f68d0bc23fe42aa413e98005f6575045,patch-1,master,666635c65d8d3bb1223b819325e0bd23c81f2733,2726d42ea62857283ee73ef3611e379b60974ad2 +github:GithubPullRequest:1:216254598,github:GithubRepo:1:134018330,,closed,graceful exit,"""graceful exit""",https://github.com/panjf2000/ants/pull/11,shanhuhai5739,github:GithubAccount:1:3794113,,11,2018-09-18T10:15:01.000+00:00,,2018-12-03T03:52:35.000+00:00,,,6a87067eb3d6440e5db17f31d4bc12ac291633f4,master,develop,833b6e29acfb2f16e3cf7fc92c79763847c319f4,a03eccc794870f0a2e55a5cb8344ea47f2a0001d +github:GithubPullRequest:1:218939809,github:GithubRepo:1:134018330,,closed,❓解决死循环导致cpu占用率过高,"""使用了cond 条件变量来阻塞Submit goroutine。潘少,你再仔细琢磨琢磨,看下有何不妥?""",https://github.com/panjf2000/ants/pull/13,liyonglion,github:GithubAccount:1:12890888,,13,2018-09-28T11:37:28.000+00:00,2018-09-29T11:29:54.000+00:00,2018-09-29T11:29:54.000+00:00,,,9a3b5cd25344822bca7684f87d9e123890a7bf59,master,master,af376f1b7b59dc488458bcecd4273f0fcde33c55,1846b4392a3a20e6bf1a7431b67f86bd43e0f0b9 +github:GithubPullRequest:1:219363161,github:GithubRepo:1:134018330,,closed,Remove meaningless if statements,"""""",https://github.com/panjf2000/ants/pull/14,SimePel,github:GithubAccount:1:20608155,,14,2018-10-01T12:48:11.000+00:00,2018-10-02T13:52:27.000+00:00,2018-10-02T13:52:27.000+00:00,,,29730bb70343924a2f56a13a9799611dd1cd27fd,master,master,1b62696050b7030106291980d5220f886b017eff,5ed168767a771e3802252020b9821610380ed1a4 +github:GithubPullRequest:1:219936521,github:GithubRepo:1:134018330,,closed,Fixes to benchmarks and added semaphore comparison,"""Benchmark results with Param=0, as time.Sleep is not stable on Windows\r\n\r\nAlso Go 1.11 has bunch of improvements:\r\n\r\n```\r\ngoos: windows\r\ngoarch: amd64\r\npkg: github.com/panjf2000/ants\r\nBenchmarkGoroutineWithFunc-8 1 3530220300 ns/op 207472 B/op 506 allocs/op\r\nBenchmarkSemaphoreWithFunc-8 1 4391916400 ns/op 20944 B/op 57 allocs/op\r\nBenchmarkAntsPoolWithFunc-8 1 5496395400 ns/op 164240 B/op 2059 allocs/op\r\nBenchmarkGoroutine-8 1 3327413400 ns/op 1552 B/op 5 allocs/op\r\nBenchmarkSemaphore-8 1 4499816000 ns/op 1264 B/op 5 allocs/op\r\nBenchmarkAntsPool-8 1 5456432100 ns/op 49208 B/op 809 allocs/op\r\nPASS\r\n```""",https://github.com/panjf2000/ants/pull/15,egonelbre,github:GithubAccount:1:192964,,15,2018-10-03T07:16:16.000+00:00,2018-10-03T12:33:59.000+00:00,2018-10-03T12:33:59.000+00:00,,,c10f80f7b760ba68bef1759f6e7921ba5e34b889,fix-benchmarks,master,29730bb70343924a2f56a13a9799611dd1cd27fd,3070771e41f0df591619c94ed0bc5c8025451302 +github:GithubPullRequest:1:222703171,github:GithubRepo:1:134018330,,closed,bugfix(check max pool size),"""if you limit max goroutine to math.Maxint32 as your code `int32(pool size)`\r\nI think should check max Goroutine size, otherwise size overflow to negative?\r\n""",https://github.com/panjf2000/ants/pull/16,rikewang,github:GithubAccount:1:24841832,,16,2018-10-14T09:21:41.000+00:00,,2018-12-03T03:53:31.000+00:00,,,1399cfa28f6751f769a985206daecb56a08b2de9,bugfix_check_max_pool_size,master,711dbdb7a222771ce15aaee1bb7b7c6e9731f208,439348b027031c793e54669fcd74eb4964c15055 +github:GithubPullRequest:1:231840723,github:GithubRepo:1:134018330,,closed,Possible memory leak because of Ticker,"""// NewTicker returns a new Ticker containing a channel that will send the\r\n// time with a period specified by the duration argument.\r\n// It adjusts the intervals or drops ticks to make up for slow receivers.\r\n// The duration d must be greater than zero; if not, NewTicker will panic.\r\n// Stop the ticker to release associated resources.\r\nfunc NewTicker(d Duration) *Ticker {\r\n……\r\n}""",https://github.com/panjf2000/ants/pull/19,zplzpl,github:GithubAccount:1:7931755,,19,2018-11-19T03:03:09.000+00:00,2018-12-01T15:49:32.000+00:00,2018-12-01T15:49:32.000+00:00,,,639f55c4c94407632a1c5e34cd71784524de0757,hotfix/tickerStop,develop,92acf74bb71c1dc1758c61346c88325284978b3e,e7bacd0f127fcde1399f92452bd0039f58916fed +github:GithubPullRequest:1:246250598,github:GithubRepo:1:134018330,,closed,feature: add PanicHandler,"""@panjf2000 PTAL\r\nFix #22 \r\nSigned-off-by: Cholerae Hu """,https://github.com/panjf2000/ants/pull/23,choleraehyq,github:GithubAccount:1:8923413,,23,2019-01-21T10:58:15.000+00:00,2019-01-22T05:41:34.000+00:00,2019-01-22T05:41:34.000+00:00,,,9158bd37025ccdd29d6346a6639a282e0060c7e2,panichandler,master,812dd4e01075be3cf97429a43abaf6837908cdcd,5bbc9e170bbee27c37bcc30da3da75b4531d1edb +github:GithubPullRequest:1:267414275,github:GithubRepo:1:134018330,,closed,goreport: lint warning on code comment structure,"""Added a newline between group comment and exported variable line 😄""",https://github.com/panjf2000/ants/pull/30,sarathsp06,github:GithubAccount:1:964542,,30,2019-04-04T11:52:48.000+00:00,2019-04-23T11:11:58.000+00:00,2019-04-23T11:11:58.000+00:00,,,dec04010834ccd3691eb1776045ce3b9310ce26c,patch-1,master,4ae3fb8dc413492862469027bb58cb45b77338f1,ec5d1f3b8107265cb53536975504c7cda4f6d68f +github:GithubPullRequest:1:292246524,github:GithubRepo:1:134018330,,closed,handle job panic,"""""",https://github.com/panjf2000/ants/pull/36,king526,github:GithubAccount:1:38849208,,36,2019-06-27T03:27:05.000+00:00,,2019-08-17T20:32:34.000+00:00,,,95e11bf85f18a80197918d15a19ec10f41903d63,master,master,05e96abd6103ae7b70436abe58dbc0ad7e740929,39f04c6e65b76b5f20abd3ca0606db4cd038e5c2 +github:GithubPullRequest:1:300598936,github:GithubRepo:1:134018330,,closed,优化清理速度并修复内存泄漏,"""""",https://github.com/panjf2000/ants/pull/39,wwjiang,github:GithubAccount:1:1290360,,39,2019-07-24T07:41:02.000+00:00,2019-07-26T04:00:12.000+00:00,2019-07-26T04:00:12.000+00:00,,,21a109c7f0873c8f466d6710de23474968940011,master,master,fc48d32604efc2b36d144b8f83d34c1aa1fda1c9,b44a12884b495713a44f796981267ed87134decb +github:GithubPullRequest:1:301421607,github:GithubRepo:1:134018330,,closed,"optimize memory allocation, change the default pool param and add the log of panic stack.","""Hi, I am using it on my online server which almost need 5 million goroutines on each go service.\r\nI'm divided into 10 small pools, because a pool of five million will slow down the speed associated with the slice.\r\nI made some small optimizations, I hope this is useful.\r\noptimize memory allocation, change the default pool param and add the log of panic stack.\r\nbtw, the default value DEFAULT_CLEAN_INTERVAL_TIME, one second is too short-lived. when the pool size is too large , Performance will drop .\r\n""",https://github.com/panjf2000/ants/pull/40,Anteoy,github:GithubAccount:1:17495446,,40,2019-07-26T07:07:06.000+00:00,2019-07-26T15:22:26.000+00:00,2019-07-26T15:22:26.000+00:00,,,3e1c7a03a512a7de8c9049d56237e5d2de2f30eb,master,master,f447bf104a4eff069b6019db406c31dd54d7b3ef,5dc8b9a71737eb57dc03fbbe3eb9010ff6c3fbb6 +github:GithubPullRequest:1:308859272,github:GithubRepo:1:134018330,,closed,support nonblocking submit and max blocking limit setting,"""Signed-off-by: Cholerae Hu """,https://github.com/panjf2000/ants/pull/41,choleraehyq,github:GithubAccount:1:8923413,,41,2019-08-20T03:24:27.000+00:00,2019-08-20T10:55:19.000+00:00,2019-08-20T10:55:19.000+00:00,,,faef79b7d8a4876da8a215d7794cce20c710aaa2,nonblocking,master,dc8169d5c2645bfc507d6993b7d215326300f31b,58466b12b03a603d9f0331bbcc64a7557b27865d +github:GithubPullRequest:1:311420898,github:GithubRepo:1:134018330,,closed,Create CODE_OF_CONDUCT.md,"""""",https://github.com/panjf2000/ants/pull/48,panjf2000,github:GithubAccount:1:7496278,,48,2019-08-27T14:44:03.000+00:00,2019-08-27T14:46:22.000+00:00,2019-08-27T14:46:22.000+00:00,,,d5eded45bffe827e5a64a3376c4b94f08b641031,add-code-of-conduct-1,master,44aec9954f58987c37d5937ba590bbf0812a32de,bba6c12b60eff3445adcc168fff3bfdcad9e2571 +github:GithubPullRequest:1:316337433,github:GithubRepo:1:134018330,,closed,Invoke decRunning() when revertWorker() returns false,"""Signed-off-by: Cholerae Hu \r\n\r\n---\r\nname: Pull request\r\nabout: Propose changes to the code\r\ntitle: ''\r\nlabels: ''\r\nassignees: ''\r\n---\r\n\r\n\r\n\r\n## 1. Are you opening this pull request for bug-fixs, optimizations or new feature?\r\n\r\n\r\n\r\n## 2. Please describe how these code changes achieve your intention.\r\n\r\n\r\n\r\n\r\n## 3. Please link to the relevant issues (if any).\r\n\r\n\r\n\r\n\r\n## 4. Which documentation changes (if any) need to be made/updated because of this PR?\r\n\r\n\r\n\r\n\r\n## 4. Checklist\r\n\r\n- [ ] I have squashed all insignificant commits.\r\n- [ ] I have commented my code for explaining package types, values, functions, and non-obvious lines.\r\n- [ ] I have written unit tests and verified that all tests passes (if needed).\r\n- [ ] I have documented feature info on the README (only when this PR is adding a new feature).\r\n- [ ] (optional) I am willing to help maintain this change if there are issues with it later.\r\n""",https://github.com/panjf2000/ants/pull/51,choleraehyq,github:GithubAccount:1:8923413,,51,2019-09-11T08:46:23.000+00:00,2019-09-12T01:00:32.000+00:00,2019-09-12T01:00:32.000+00:00,,,d6cd5a7e726c9bb8578e7aabdbf3488dc8d080b6,fixbug,master,280ac345a860e794df1268e15112db9a863900ca,6495acc77318c3944e3edd3f983a03fc9027324a +github:GithubPullRequest:1:325179595,github:GithubRepo:1:134018330,,closed,add loop queue ,"""---\r\nname: Pull request\r\nabout: 抽象出worker队列的实现,使用原先和循环队列实现这个接口\r\ntitle: ''\r\nlabels: ''\r\nassignees: ''\r\n---\r\n\r\n\r\n\r\n## 1. Are you opening this pull request for bug-fixs, optimizations or new feature?\r\n抽象了 worker 队列,实现了两种队列的方式,也可以方便的新加队列实现,只要符合 WorkerQueue 即可\r\n\r\n## 2. Please describe how these code changes achieve your intention.\r\n\r\n1. 抽象woker队列为WorkerQueue 的 interface{}\r\n2. 模仿之前的方式实现了 SliceQueue 队列,还是使用了 slice\r\n3. 新加了循环队列 LoopQueue,也是使用 slice 实现,但是会减少内存的copy操作(原先会在periodicallyPurge有slice拷贝的操作)\r\n4. 修改了在查询超时时间时,使用二分查找的算法。\r\n\r\n潘少,目前我修改了 pool。如果潘少觉得这个方案可行,我可以再把 PoolWithFunc 按照这种方式修改。\r\n\r\n## 3. Please link to the relevant issues (if any).\r\n\r\n\r\n\r\n\r\n## 4. Which documentation changes (if any) need to be made/updated because of this PR?\r\n\r\n\r\n\r\n\r\n## 4. Checklist\r\n\r\n- [x] I have squashed all insignificant commits.\r\n- [ ] I have commented my code for explaining package types, values, functions, and non-obvious lines.\r\n- [x] I have written unit tests and verified that all tests passes (if needed).\r\n- [ ] I have documented feature info on the README (only when this PR is adding a new feature).\r\n- [ ] (optional) I am willing to help maintain this change if there are issues with it later.\r\n""",https://github.com/panjf2000/ants/pull/53,KevinBaiSg,github:GithubAccount:1:2813260,,53,2019-10-07T08:17:20.000+00:00,2019-10-09T16:59:19.000+00:00,2019-10-09T16:59:19.000+00:00,,,f0e23928f4388661a8e0f6f5ff93f8f9514a1762,feature/loopQueue,master,66350c88dbd991f49ca95454e2d8485ca990fd30,6ef45a0a1fd2ad8878c5684e9ec1baf8aab24f87 +github:GithubPullRequest:1:329127652,github:GithubRepo:1:134018330,,closed,throw out default panic,"""\r\n5.10. Recover\r\nRecovering indiscriminately from panics is a dubious practice because the state of a package’s variables after a panic is rarely well defined or documented. Perhaps a critical update to a data structure was incomplete, a file or net work connection was opened but not closed, or a lock was acquired but not released. Furthermore, by replacing a crash with, say, a line in a log file, indiscriminate recovery may cause bugs to go unnoticed.\r\n\r\n---\r\nname: Pull request\r\nabout: Propose changes to the code\r\ntitle: ''\r\nlabels: ''\r\nassignees: ''\r\n---\r\n\r\n\r\n\r\n## 1. Are you opening this pull request for bug-fixs, optimizations or new feature?\r\n\r\n\r\n\r\n## 2. Please describe how these code changes achieve your intention.\r\n\r\n\r\n\r\n\r\n## 3. Please link to the relevant issues (if any).\r\n\r\n\r\n\r\n\r\n## 4. Which documentation changes (if any) need to be made/updated because of this PR?\r\n\r\n\r\n\r\n\r\n## 4. Checklist\r\n\r\n- [ ] I have squashed all insignificant commits.\r\n- [ ] I have commented my code for explaining package types, values, functions, and non-obvious lines.\r\n- [ ] I have written unit tests and verified that all tests passes (if needed).\r\n- [ ] I have documented feature info on the README (only when this PR is adding a new feature).\r\n- [x] (optional) I am willing to help maintain this change if there are issues with it later.\r\n""",https://github.com/panjf2000/ants/pull/54,polar9527,github:GithubAccount:1:8644923,,54,2019-10-17T08:18:41.000+00:00,,2019-10-18T02:07:14.000+00:00,,,f1ce1289901ab1bed876ec9ec21eb144d9c52b6d,master,master,52b301019a4bd8cb6b56a3b51d3087cd71b66386,979da84674d28c21394afec4b8e8559aed85d4eb +github:GithubPullRequest:1:346931859,github:GithubRepo:1:134018330,,closed,Refine the indentation of the sample code in READMEs,"""""",https://github.com/panjf2000/ants/pull/66,RealLiuSha,github:GithubAccount:1:5715152,,66,2019-11-29T07:50:17.000+00:00,,2019-11-29T07:52:04.000+00:00,,,1acafed7740d0daf1dcc3a30129798f59c234331,master,master,fd3841dd88c15fcc0e0ea94e606d980221ac5e09,b19edbd7b909527b2cc2a759e7a60133497f9dee +github:GithubPullRequest:1:379435034,github:GithubRepo:1:134018330,,closed,Fix a bug that doesn't release lock,"""err!=nil时未释放锁,使用defer p.lock.Unlock()修复\r\n\r\n---\r\nname: Pull request\r\nabout: Propose changes to the code\r\ntitle: ''\r\nlabels: ''\r\nassignees: ''\r\n---\r\n\r\n\r\n\r\n## 1. Are you opening this pull request for bug-fixs, optimizations or new feature?\r\n\r\n\r\n\r\n## 2. Please describe how these code changes achieve your intention.\r\n\r\n\r\n\r\n\r\n## 3. Please link to the relevant issues (if any).\r\n\r\n\r\n\r\n\r\n## 4. Which documentation changes (if any) need to be made/updated because of this PR?\r\n\r\n\r\n\r\n\r\n## 4. Checklist\r\n\r\n- [ ] I have squashed all insignificant commits.\r\n- [ ] I have commented my code for explaining package types, values, functions, and non-obvious lines.\r\n- [ ] I have written unit tests and verified that all tests passes (if needed).\r\n- [ ] I have documented feature info on the README (only when this PR is adding a new feature).\r\n- [x] (optional) I am willing to help maintain this change if there are issues with it later.\r\n""",https://github.com/panjf2000/ants/pull/79,lam2003,github:GithubAccount:1:22312935,,79,2020-02-25T08:30:05.000+00:00,2020-02-26T03:15:03.000+00:00,2020-02-26T03:15:03.000+00:00,,,d8cb0361988bf8a0a2a5bee93a06f9c4e1b65e61,master,master,c3b448271b0f84fd3e850b679bf29e7965fe7608,e7a2d3706bf4d32f0e927258b10d2a3585b9ed7d +github:GithubPullRequest:1:404931293,github:GithubRepo:1:134018330,,closed,fix:v2 dir not exist,"""---\r\nname: Pull request\r\nabout: Propose changes to the code\r\ntitle: ''\r\nlabels: ''\r\nassignees: ''\r\n---\r\n\r\n\r\n\r\n## 1. Are you opening this pull request for bug-fixs, optimizations or new feature?\r\n\r\nbug-fix\r\n\r\n## 2. Please describe how these code changes achieve your intention.\r\n\r\nI need to use this repo, but it has errors. \r\nThere is a internal dir, but no v2/internal and v2/internal is used in repo. i just added a new v2/internal dir copied from internal dir.\r\n\r\n\r\n\r\n## 3. Please link to the relevant issues (if any).\r\n\r\n\r\n\r\n\r\n## 4. Which documentation changes (if any) need to be made/updated because of this PR?\r\n\r\n\r\n\r\n\r\n## 4. Checklist\r\n\r\n- [ ] I have squashed all insignificant commits.\r\n- [ ] I have commented my code for explaining package types, values, functions, and non-obvious lines.\r\n- [ ] I have written unit tests and verified that all tests passes (if needed).\r\n- [ ] I have documented feature info on the README (only when this PR is adding a new feature).\r\n- [ ] (optional) I am willing to help maintain this change if there are issues with it later.\r\n""",https://github.com/panjf2000/ants/pull/87,shanghai-Jerry,github:GithubAccount:1:12420699,,87,2020-04-17T05:34:28.000+00:00,,2020-04-19T03:03:07.000+00:00,,,010ef635a955c8ab81620e78099440311f273111,master,master,f33679bb799fe76b52d47d3172c40ce229463198,402dcefd038c7db892b3c433d1d93e09a3e48652 +github:GithubPullRequest:1:410487606,github:GithubRepo:1:134018330,,closed,Fix indent on README,"""---\r\nname: Pull request\r\nabout: Propose changes to the code\r\ntitle: 'Fix indent'\r\nlabels: ''\r\nassignees: ''\r\n---\r\n\r\n\r\n\r\n## 1. Are you opening this pull request for bug-fixs, optimizations or new feature?\r\n\r\nNo.\r\n\r\n## 2. Please describe how these code changes achieve your intention.\r\n\r\n\r\nThere are wrong idents on README.md.\r\n\r\n## 3. Please link to the relevant issues (if any).\r\n\r\n\r\n\r\n\r\n## 4. Which documentation changes (if any) need to be made/updated because of this PR?\r\n\r\n\r\n\r\n\r\n## 4. Checklist\r\n\r\n- [x] I have squashed all insignificant commits.\r\n- [ ] I have commented my code for explaining package types, values, functions, and non-obvious lines.\r\n- [ ] I have written unit tests and verified that all tests passes (if needed).\r\n- [ ] I have documented feature info on the README (only when this PR is adding a new feature).\r\n- [ ] (optional) I am willing to help maintain this change if there are issues with it later.\r\n""",https://github.com/panjf2000/ants/pull/89,wreulicke,github:GithubAccount:1:12907474,,89,2020-04-29T04:51:26.000+00:00,2020-04-29T07:08:43.000+00:00,2020-04-29T07:08:43.000+00:00,,,88b5a85d64e3aa487f157dc6266472a7a14eeb0d,patch-1,master,f33679bb799fe76b52d47d3172c40ce229463198,51f1f518835109c3de3cfa42bf29a01cc5fcd788 +github:GithubPullRequest:1:415925259,github:GithubRepo:1:134018330,,closed,支持配置workerChanCap大小,"""---\r\nname: Pull request\r\nabout: support customize workerChanCap \r\ntitle: ''\r\nlabels: ''\r\nassignees: ''\r\n---\r\n\r\n\r\n\r\n## 1. Are you opening this pull request for bug-fixs, optimizations or new feature?\r\n\r\n\r\n\r\n## 2. Please describe how these code changes achieve your intention.\r\n\r\n\r\n\r\n\r\n## 3. Please link to the relevant issues (if any).\r\n\r\n\r\n\r\n\r\n## 4. Which documentation changes (if any) need to be made/updated because of this PR?\r\n\r\n\r\n\r\n\r\n## 4. Checklist\r\n\r\n- [x] I have squashed all insignificant commits.\r\n- [x] I have commented my code for explaining package types, values, functions, and non-obvious lines.\r\n- [ ] I have written unit tests and verified that all tests passes (if needed).\r\n- [ ] I have documented feature info on the README (only when this PR is adding a new feature).\r\n- [ ] (optional) I am willing to help maintain this change if there are issues with it later.\r\n""",https://github.com/panjf2000/ants/pull/91,lntotk,github:GithubAccount:1:5227289,,91,2020-05-11T07:40:41.000+00:00,,2020-05-11T09:27:30.000+00:00,,,ff938265a22ac26c4a2ff7ee0f696cf4fe9e3895,master,master,1c534853c887e0a7b0d56d51303bf09f201e26a0,b1ce6e8fb4f31b4d75b748bbe2d03c28e0f737f2 +github:GithubPullRequest:1:452382525,github:GithubRepo:1:134018330,,closed,chore: support go1.14,"""as title.""",https://github.com/panjf2000/ants/pull/100,appleboy,github:GithubAccount:1:21979,,100,2020-07-19T06:38:38.000+00:00,2020-07-19T14:59:48.000+00:00,2020-07-19T14:59:48.000+00:00,,,0a7be73d35726850863a80432dec0ac5c78cdfb4,patch,master,b2666199751ef4fe666c175ba667d18a182b67e0,18623ceb17a9230484ff5d1a31c3beb0b631a2f3 +github:GithubPullRequest:1:461992435,github:GithubRepo:1:134018330,,closed,Add a Gitter chat badge to README.md,"""### panjf2000/ants now has a Chat Room on Gitter\n\n@panjf2000 has just created a chat room. You can visit it here: [https://gitter.im/ants-pool/ants](https://gitter.im/ants-pool/ants?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&content=body_link).\n\nThis pull-request adds this badge to your README.md:\n\n\n[![Gitter](https://badges.gitter.im/ants-pool/ants.svg)](https://gitter.im/ants-pool/ants?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=body_badge)\n\nIf my aim is a little off, please [let me know](https://gitlab.com/gitlab-org/gitter/readme-badger/issues).\n\nHappy chatting.\n\n\nPS: [Click here](https://gitter.im/settings/badger/opt-out) if you would prefer not to receive automatic pull-requests from Gitter in future.\n""",https://github.com/panjf2000/ants/pull/103,gitter-badger,github:GithubAccount:1:8518239,,103,2020-08-03T07:12:25.000+00:00,,2020-08-03T07:17:52.000+00:00,,,acb7f9847897513820e2467ef9720cb213a97133,gitter-badge,master,c32db55d3e7e19d8300760de03584072b6a9de93,f323aef64aa8b47b777037502adf6eca0b2f4fd0 +github:GithubPullRequest:1:475457581,github:GithubRepo:1:134018330,,closed,Avoid memory leak,"""---\r\nname: Pull request\r\nabout: Propose changes to the code\r\ntitle: 'avoid memory leaky'\r\nlabels: 'gc'\r\nassignees: ''\r\n---\r\n\r\n\r\n\r\n## 1. Are you opening this pull request for bug-fixs, optimizations or new feature?\r\n bug fix\r\n\r\n\r\n## 2. Please describe how these code changes achieve your intention.\r\n\r\n 我认为在对stack,loop queue在出栈或出队需要对不使用的切片元素进行置为nil操作,因为是指针,不应该留在未使用的切片位置,在突发任务需要goroutine时,会分配大量的goWorker并进入工作,但是当没有突发任务时,这些都在空闲队列或队列中是没有回收的,但是当超过存活时间,进行回收时,还是有底层的数据持有(未置为nil),个人认为会占有大量的内存,这部份应该真正的交还给sync.Pool.\r\n 另外,假设在sync.Pool和切片底层数组同时持有同一个对象,不知道go的gc是什么行为? \r\n\r\n## 3. Please link to the relevant issues (if any).\r\n\r\n\r\n\r\n\r\n## 4. Which documentation changes (if any) need to be made/updated because of this PR?\r\n\r\n\r\n\r\n\r\n## 4. Checklist\r\n\r\n- [x] I have squashed all insignificant commits.\r\n- [ ] I have commented my code for explaining package types, values, functions, and non-obvious lines.\r\n- [ ] I have written unit tests and verified that all tests passes (if needed).\r\n- [ ] I have documented feature info on the README (only when this PR is adding a new feature).\r\n- [x] (optional) I am willing to help maintain this change if there are issues with it later.\r\n""",https://github.com/panjf2000/ants/pull/107,thinkgos,github:GithubAccount:1:49174849,,107,2020-08-28T15:02:33.000+00:00,2020-08-29T10:51:57.000+00:00,2020-08-29T10:51:57.000+00:00,,,ef6017217221e20416d886c0231dd5134752ef4e,master,master,21f632368adbd3b3af71038ab697a6585a40db62,e2ccffc1650009dcf72cf93dbe95888abfba63eb +github:GithubPullRequest:1:496172205,github:GithubRepo:1:134018330,,closed,Remove underscore from file names,"""\r\n## 1. Are you opening this pull request for bug-fixes, optimizations, or new features?\r\nFixing the file naming convention based on [this](https://golang.org/doc/effective_go.html#package-names).\r\n\r\n## 2. Please describe how these code changes achieve your intention.\r\nThere is no code change\r\n\r\n\r\n\r\n_(Feel free to reject this PR if you think it's unnecessary)_""",https://github.com/panjf2000/ants/pull/111,arjunmahishi,github:GithubAccount:1:11977524,,111,2020-10-01T11:08:20.000+00:00,,2020-10-04T07:42:53.000+00:00,,,21ae8e46646bff4ef8804892b5d2f064b0772efc,fix/file-naming-convention,master,ef6017217221e20416d886c0231dd5134752ef4e,7403b395ea8e1a39ca7a2f29aee7b4735cb988ef +github:GithubPullRequest:1:502102437,github:GithubRepo:1:134018330,,closed,fix: Memory leak,"""Fixes #113""",https://github.com/panjf2000/ants/pull/114,Mutated1994,github:GithubAccount:1:29589055,,114,2020-10-13T08:37:37.000+00:00,2020-10-15T03:35:56.000+00:00,2020-10-15T03:35:56.000+00:00,,,94a7a7f1cb3a11fcaaf9608c94fe1dc0bcd98ab0,master,master,ef6017217221e20416d886c0231dd5134752ef4e,00691c648a5b7d28dba5bcafa05d9bbccdf4d933 +github:GithubPullRequest:1:505486248,github:GithubRepo:1:134018330,,closed,fix set negative size,"""fix set negative size for pool\r\n""",https://github.com/panjf2000/ants/pull/117,imxyb,github:GithubAccount:1:7411249,,117,2020-10-18T14:58:12.000+00:00,,2020-10-19T01:58:45.000+00:00,,,55d7f5eb6298d59b76a26b56d1bbb776503a8563,hotfix-poolsize,master,94a7a7f1cb3a11fcaaf9608c94fe1dc0bcd98ab0,05a3664dbf966f1a7ced274aaf47d34e644287ef +github:GithubPullRequest:1:543900177,github:GithubRepo:1:134018330,,closed,Add go1.15.x support on CI,"""Add go1.15.x support on CI""",https://github.com/panjf2000/ants/pull/131,kaiiak,github:GithubAccount:1:2832687,,131,2020-12-22T06:25:18.000+00:00,,2021-03-19T02:15:23.000+00:00,,,545d5f0c007d1d5e2cd23ae2d9074365c0f03790,patch-1,master,fd8d670fd09489e6ea7693c0a382ba85d2694f16,15cb2705734c62544ac5dca0de3f28f03a69a854 +github:GithubPullRequest:1:582870188,github:GithubRepo:1:134018330,,closed,Change the writing of if...err,"""---\r\nname: Pull request\r\nabout: Propose changes to the code\r\ntitle: ''\r\nlabels: ''\r\nassignees: ''\r\n---\r\n\r\n\r\n\r\n## 1. Are you opening this pull request for bug-fixs, optimizations or new feature?\r\n\r\n\r\n\r\n## 2. Please describe how these code changes achieve your intention.\r\n\r\n\r\n\r\n\r\n## 3. Please link to the relevant issues (if any).\r\n\r\n\r\n\r\n\r\n## 4. Which documentation changes (if any) need to be made/updated because of this PR?\r\n\r\n\r\n\r\n\r\n## 4. Checklist\r\n\r\n- [x] I have squashed all insignificant commits.\r\n- [x] I have commented my code for explaining package types, values, functions, and non-obvious lines.\r\n- [x] I have written unit tests and verified that all tests passes (if needed).\r\n- [x] I have documented feature info on the README (only when this PR is adding a new feature).\r\n- [x] (optional) I am willing to help maintain this change if there are issues with it later.\r\n""",https://github.com/panjf2000/ants/pull/136,Comolli,github:GithubAccount:1:47921612,,136,2021-03-02T09:24:36.000+00:00,,2021-03-11T02:27:15.000+00:00,,,ed97c442167956de4aa11495a37f2557edebd904,master,master,fd8d670fd09489e6ea7693c0a382ba85d2694f16,5431f73492ade2e5b947a98f6032595c32cf730e +github:GithubPullRequest:1:586207150,github:GithubRepo:1:134018330,,closed,The program should return directly when the pool size passed in when …,"""…calling the NewPool interface is less than or equal to 0\r\n\r\n---\r\nname: Pull request\r\nabout: Propose changes to the code\r\ntitle: 'code improve'\r\n---\r\n""",https://github.com/panjf2000/ants/pull/139,zhangyuanxue,github:GithubAccount:1:32893410,,139,2021-03-07T08:00:46.000+00:00,,2021-03-12T12:45:57.000+00:00,,,9a4288b9368ab4551d967fddda163d6be2182fde,feature/zhangyuanxue/dev,master,fd8d670fd09489e6ea7693c0a382ba85d2694f16,ba4160c5fd41151ebbd50cb786c5ce21711b5a7b +github:GithubPullRequest:1:607755003,github:GithubRepo:1:134018330,,closed,pool_list,"""sequence""",https://github.com/panjf2000/ants/pull/149,yddeng,github:GithubAccount:1:41562937,,149,2021-04-02T01:16:21.000+00:00,,2021-04-02T04:09:52.000+00:00,,,fd1b0378ee9b60fe32a2fe5c8198a427e5f46949,pool_list,master,dbcb6a104f23b1a6a7521796b30515230353283e,674fe08bb2c2ced275600ebdddf2412c84e2c349 +github:GithubPullRequest:1:654684379,github:GithubRepo:1:134018330,,open,Submit a task with args to pool,"""---\r\nname: Resolve problem with args capturing\r\n---\r\n\r\n\r\n\r\n## 1. Are you opening this pull request for bug-fixs, optimizations or new feature?\r\nNew feature.\r\n\r\n\r\n## 2. Please describe how these code changes achieve your intention.\r\n\r\nSometimes, we need to call go-routines with args, but by default we have problem - wrong args capturing. And pool has the same problem. This PR resolves this problem.\r\n\r\n\r\n## 3. Please link to the relevant issues (if any).\r\n\r\n\r\n\r\n\r\n## 4. Which documentation changes (if any) need to be made/updated because of this PR?\r\n\r\n\r\n\r\n\r\n## 4. Checklist\r\n\r\n- [x] I have squashed all insignificant commits.\r\n- [x] I have commented my code for explaining package types, values, functions, and non-obvious lines.\r\n- [x] I have written unit tests and verified that all tests passes (if needed).\r\n- [x] I have documented feature info on the README (only when this PR is adding a new feature).\r\n- [ ] (optional) I am willing to help maintain this change if there are issues with it later.\r\n""",https://github.com/panjf2000/ants/pull/158,icecube092,github:GithubAccount:1:58211133,,158,2021-05-27T08:53:42.000+00:00,,,,,077334b198b9af2322e214675bb4fcb62b0a7c0c,args_capture,master,134f354e8e3ba73a35bc7da671ea6d1a8001d35d,2dd731d5897d50508e9d262cf64a8f4807f0f42f +github:GithubPullRequest:1:669972849,github:GithubRepo:1:134018330,,open,allow NewPoolWithFunc can invoke with nil argument,"""2. abstract a Task interface for SubmitTask which is more convenient\r\n\r\n---\r\nname: Pull request\r\nabout: Propose changes to the code\r\ntitle: 'allow NewPoolWithFunc can invoke with nil argument'\r\nlabels: ''\r\nassignees: ''\r\n---\r\n\r\n\r\n\r\n## 1. Are you opening this pull request for bug-fixs, optimizations or new feature?\r\n\r\noptimizations\r\n\r\n\r\n## 2. Please describe how these code changes achieve your intention.\r\n\r\n\r\n1. allow NewPoolWithFunc can invoke with nil argument\r\n2. abstract a Task interface for SubmitTask which is more convenient\r\n\r\n## 3. Please link to the relevant issues (if any).\r\nnone\r\n\r\n## 4. Which documentation changes (if any) need to be made/updated because of this PR?\r\n\r\nnone\r\n\r\n\r\n## 4. Checklist\r\n\r\n- [x] I have squashed all insignificant commits.\r\n- [ ] I have commented my code for explaining package types, values, functions, and non-obvious lines.\r\n- [x] I have written unit tests and verified that all tests passes (if needed).\r\n- [ ] I have documented feature info on the README (only when this PR is adding a new feature).\r\n- [ ] (optional) I am willing to help maintain this change if there are issues with it later.\r\n""",https://github.com/panjf2000/ants/pull/167,bingoohuang,github:GithubAccount:1:1940588,,167,2021-06-15T00:57:34.000+00:00,,,,,eb924ade19ae94cc8f85cab39a71f6afa56fdef3,master,master,134f354e8e3ba73a35bc7da671ea6d1a8001d35d,9915f61140287a2f768fcaf71f6d5bd6454521c9 +github:GithubPullRequest:1:686947632,github:GithubRepo:1:134018330,,closed,Timing issue in the TestNonblockingSubmitWithFunc,"""On some machines this unit would fail due to a timing issue. Since the Invoke in the loop was using nil as the param, it would (depending on timing) lead to the workers finishing the (w *goWorkerWithFunc) run() in the range loop over w.args as args would == nil and return. \r\n\r\nIf an explicit time.Sleep(1 * time.Second) is added before the \""\tassert.EqualError(t, p.Invoke(nil), ErrPoolOverload.Error(),\"" it is easily reproducible.\r\n\r\n---\r\nname: Pull request\r\nabout: Propose changes to the code\r\ntitle: ''\r\nlabels: ''\r\nassignees: ''\r\n---\r\n\r\n\r\n\r\n## 1. Are you opening this pull request for bug-fixs, optimizations or new feature?\r\n\r\nbug-fix\r\n\r\n## 2. Please describe how these code changes achieve your intention.\r\n\r\n\r\nstated above\r\n\r\n## 3. Please link to the relevant issues (if any).\r\n\r\n\r\nn/a\r\n\r\n## 4. Which documentation changes (if any) need to be made/updated because of this PR?\r\n\r\n\r\nn/a\r\n\r\n## 4. Checklist\r\n\r\n- [x] I have squashed all insignificant commits.\r\n- [x] I have commented my code for explaining package types, values, functions, and non-obvious lines.\r\n- [x] I have written unit tests and verified that all tests passes (if needed).\r\n- [x] I have documented feature info on the README (only when this PR is adding a new feature).\r\n- [x] (optional) I am willing to help maintain this change if there are issues with it later.\r\n""",https://github.com/panjf2000/ants/pull/172,jdamick,github:GithubAccount:1:12317,,172,2021-07-09T17:43:56.000+00:00,2021-07-12T14:52:47.000+00:00,2021-07-12T14:52:47.000+00:00,,,63489606efd8498bdd76c375b2913e7decaa1e63,patch-1,master,4b16a811165326723182488f21b22ea6761418f4,57eb78708675c067aeadad224f0ce57a53edc248 +github:GithubPullRequest:1:693963625,github:GithubRepo:1:134018330,,closed,Fix CI workflow to make the cache action really work,"""workflows add cache mod file\r\nworkflows should be restore cache before unit test\r\nlink [actions/cache](https://github.com/marketplace/actions/cache)\r\n---\r\nname: Pull request\r\nabout: Propose changes to the code\r\ntitle: 'workflows'\r\nlabels: 'workflows'\r\nassignees: ''\r\n---\r\n\r\n## 1. Are you opening this pull request for bug-fixs, optimizations or new feature?\r\n fix workflows\r\n## 2. Please describe how these code changes achieve your intention.\r\n no\r\n## 3. Please link to the relevant issues (if any).\r\n no\r\n## 4. Which documentation changes (if any) need to be made/updated because of this PR?\r\n no\r\n\r\n## 4. Checklist\r\n\r\n- [x] I have squashed all insignificant commits.\r\n- [x] I have commented my code for explaining package types, values, functions, and non-obvious lines.\r\n- [x] I have written unit tests and verified that all tests passes (if needed).\r\n- [x] I have documented feature info on the README (only when this PR is adding a new feature).\r\n- [x] (optional) I am willing to help maintain this change if there are issues with it later.\r\n""",https://github.com/panjf2000/ants/pull/174,thinkgos,github:GithubAccount:1:49174849,,174,2021-07-21T00:56:19.000+00:00,2021-07-21T03:21:49.000+00:00,2021-07-21T03:21:49.000+00:00,,,cfb27797a83ff7ea787acf1c6627657ac174dca3,master,master,63489606efd8498bdd76c375b2913e7decaa1e63,1a658c033be78d2dea8db57c166ee4ba3ad951f7 +github:GithubPullRequest:1:696437287,github:GithubRepo:1:134018330,,open,feat: goroutine exits immediately,"""---\r\nname: goroutine exits immediately\r\nabout: goroutine exits immediately, lazy init defaultAntsPool\r\ntitle: 'goroutine exits immediately'\r\nlabels: ''\r\nassignees: 'panjf2000'\r\n---\r\n\r\n\r\n\r\n## 1. Are you opening this pull request for bug-fixs, optimizations or new feature?\r\n\r\noptimizations\r\n\r\nFirst of all, thanks to ants for maintaining a good pool implementation. In the process of using it, it was found that some goroutines did not exit when Release was called. This mr change will cause all goroutines to exit immediately.\r\nExcept for the first time, the global defaultAntsPool will be created by default. In this mr, defaultAntsPool will be created the first time it is called.\r\n\r\n## 2. Please describe how these code changes achieve your intention.\r\n\r\n\r\nTODO\r\n\r\n## 3. Please link to the relevant issues (if any).\r\n\r\n\r\nTODO\r\n\r\n## 4. Which documentation changes (if any) need to be made/updated because of this PR?\r\n\r\n\r\nTODO\r\n\r\n## 4. Checklist\r\n\r\n- [x] I have squashed all insignificant commits.\r\n- [x] I have commented my code for explaining package types, values, functions, and non-obvious lines.\r\n- [x] I have written unit tests and verified that all tests passes (if needed).\r\n- [x] I have documented feature info on the README (only when this PR is adding a new feature).\r\n""",https://github.com/panjf2000/ants/pull/176,exfly,github:GithubAccount:1:22613193,,176,2021-07-25T03:44:37.000+00:00,,,,,caecc9821c7f6f304bd2325bcb200b69f0489210,feat-goroutine-exits-immediately,master,134f354e8e3ba73a35bc7da671ea6d1a8001d35d,12dd0eaff299e7425062bab820801494355e025b +github:GithubPullRequest:1:731946063,github:GithubRepo:1:134018330,,closed,style: fixed some typos in the comments,"""---\r\nname: Pull request\r\nabout: typos in comments\r\ntitle: fixed some typos in the comments\r\nlabels: \r\nassignees: @panjf2000 \r\n---\r\n\r\n\r\n\r\n## 1. Are you opening this pull request for bug-fixs, optimizations or new feature?\r\n\r\nfixed some typos only for comments\r\n\r\n## 2. Please describe how these code changes achieve your intention.\r\n\r\n\r\nfixed some typos only for comments\r\n\r\n## 3. Please link to the relevant issues (if any).\r\n\r\n\r\nno issues related\r\n\r\n## 4. Which documentation changes (if any) need to be made/updated because of this PR?\r\n\r\n\r\nno need for docs change\r\n\r\n## 4. Checklist\r\n\r\n- [x] I have squashed all insignificant commits.\r\n- [x] I have commented my code for explaining package types, values, functions, and non-obvious lines.\r\n- [ ] I have written unit tests and verified that all tests passes (if needed).\r\n- [ ] I have documented feature info on the README (only when this PR is adding a new feature).\r\n- [x] (optional) I am willing to help maintain this change if there are issues with it later.\r\n""",https://github.com/panjf2000/ants/pull/184,automano,github:GithubAccount:1:17286982,,184,2021-09-11T15:06:25.000+00:00,2021-09-13T03:57:25.000+00:00,2021-09-13T03:57:25.000+00:00,,,f62e8ab1e0a951ab278ac794979b27ebd89ab0b5,master,master,6de43fdfb9f358a7552f05d0989710dd89380236,2201960d862462743cc1c9da0ca0911d905f25d3 +github:GithubPullRequest:1:736936308,github:GithubRepo:1:134018330,,closed,Update the link of one of the relevant articles,"""Hello! I never got the chance to mention it before, but thank you for linking one of my articles in your repository :) \r\n\r\n## 1. Are you opening this pull request for bug-fixs, optimizations or new feature?\r\nNo\r\n\r\n\r\n## 2. Please describe how these code changes achieve your intention.\r\nI'm working on migrating my domain from `twinnation.org` to `twin.sh`, thus I'm preemptively updating the link to prevent it from becoming dead at some point\r\n\r\n\r\n## 3. Please link to the relevant issues (if any).\r\nN/A\r\n\r\n\r\n## 4. Which documentation changes (if any) need to be made/updated because of this PR?\r\nN/A\r\n\r\n\r\n## 5. Checklist\r\n\r\n- [X] I have squashed all insignificant commits.\r\n- [X] I have commented my code for explaining package types, values, functions, and non-obvious lines.\r\n- [X] I have written unit tests and verified that all tests passes (if needed).\r\n- [X] I have documented feature info on the README (only when this PR is adding a new feature).\r\n- [X] (optional) I am willing to help maintain this change if there are issues with it later.\r\n""",https://github.com/panjf2000/ants/pull/185,TwiN,github:GithubAccount:1:15699766,,185,2021-09-18T17:06:03.000+00:00,2021-09-19T02:56:40.000+00:00,2021-09-19T02:56:40.000+00:00,,,61d120b6f086998184f402a83ace485a036d4c7d,patch-1,master,f62e8ab1e0a951ab278ac794979b27ebd89ab0b5,71fd3a37d0df59cf1e73fa1272ecd92bab11a7c1 +github:GithubPullRequest:1:742901118,github:GithubRepo:1:134018330,,closed,Update the link of one of the relevant articles,"""re: #185\r\n\r\nMissed the `README_ZH.md` file 😅 """,https://github.com/panjf2000/ants/pull/186,TwiN,github:GithubAccount:1:15699766,,186,2021-09-26T15:53:39.000+00:00,2021-09-27T02:38:55.000+00:00,2021-09-27T02:38:55.000+00:00,,,3f9c4cd54898e7149c7f6d072213b8fdbd0036d8,patch-1,master,61d120b6f086998184f402a83ace485a036d4c7d,41f6b572b25da6363d7d7c45b77705fd8bee7466 +github:GithubPullRequest:1:757412327,github:GithubRepo:1:134018330,,closed,add shopify into user cases,"""Fixes https://github.com/panjf2000/ants/issues/188""",https://github.com/panjf2000/ants/pull/189,lilien1010,github:GithubAccount:1:3814966,,189,2021-10-13T13:34:05.000+00:00,2021-10-13T13:42:42.000+00:00,2021-10-13T13:42:42.000+00:00,,,76ce0ce24f21b1dd13050e0c84b07ce55e68f111,add-shopify-as-user-case,master,3f9c4cd54898e7149c7f6d072213b8fdbd0036d8,efe0bad6c0ab13b54d00909864e34a1060e41d6e +github:GithubPullRequest:1:763816683,github:GithubRepo:1:134018330,,closed,add more test about spinlock,"""---\r\nname: Pull request\r\nabout: add more test about spinlock\r\ntitle: ''\r\nlabels: ''\r\nassignees: ''\r\n---\r\n\r\n\r\n\r\n## 1. Are you opening this pull request for bug-fixs, optimizations or new feature?\r\n just add more test about spinlock\r\n\r\n\r\n## 2. Please describe how these code changes achieve your intention.\r\n\r\n \r\nSimulate the performance comparison of spinlock with and without backoff and mutex in different scenarios\r\n\r\n\r\n## 3. Please link to the relevant issues (if any).\r\n\r\nFixes #191 \r\n\r\n\r\n## 4. Which documentation changes (if any) need to be made/updated because of this PR?\r\n\r\n\r\n\r\n\r\n## 4. Checklist\r\n\r\n- [x] I have squashed all insignificant commits.\r\n- [x] I have commented my code for explaining package types, values, functions, and non-obvious lines.\r\n- [x] I have written unit tests and verified that all tests passes (if needed).\r\n- [ ] I have documented feature info on the README (only when this PR is adding a new feature).\r\n- [x] I (optional) I am willing to help maintain this change if there are issues with it later.\r\n""",https://github.com/panjf2000/ants/pull/192,liu-song,github:GithubAccount:1:22676124,,192,2021-10-22T02:53:44.000+00:00,,2021-11-27T13:44:28.000+00:00,,,74520b109f893c8e4a85e6a4b8cad96dcddc8d94,master,master,d3e3a334a3b1a5b80e75b296ebd84fe89f5edec0,d16a241d2624bf815159acf091d6f62e663af999 +github:GithubPullRequest:1:770998086,github:GithubRepo:1:134018330,,closed,Replace goto with simple for loop,"""---\r\nname: Pull request\r\nabout: Replace goto with simple for loop\r\ntitle: 'Replace goto with simple for loop'\r\nlabels: ''\r\nassignees: ''\r\n---\r\n\r\n\r\n\r\n## 1. Are you opening this pull request for bug-fixs, optimizations or new feature?\r\n\r\noptimizations\r\n\r\n## 2. Please describe how these code changes achieve your intention.\r\n\r\n\r\nReplace goto with simple for loop\r\n\r\n## 3. Please link to the relevant issues (if any).\r\n\r\n\r\nnone\r\n\r\n## 4. Which documentation changes (if any) need to be made/updated because of this PR?\r\n\r\n\r\nnone\r\n\r\n## 4. Checklist\r\n\r\n- [x] I have squashed all insignificant commits.\r\n- [x] I have commented my code for explaining package types, values, functions, and non-obvious lines.\r\n- [x] I have written unit tests and verified that all tests passes (if needed).\r\n- [x] I have documented feature info on the README (only when this PR is adding a new feature).\r\n- [x] (optional) I am willing to help maintain this change if there are issues with it later.\r\n""",https://github.com/panjf2000/ants/pull/193,lord63,github:GithubAccount:1:5268051,,193,2021-11-02T00:36:11.000+00:00,,2021-11-18T14:44:40.000+00:00,,,46126780142e06608ca4c49572160365f8f92282,drop-goto-usage-with-for,master,76ce0ce24f21b1dd13050e0c84b07ce55e68f111,676e5c84e4da504bb4577e1af0b37b7c82cc52ad +github:GithubPullRequest:1:791490205,github:GithubRepo:1:134018330,,closed,optimize: calculating mid in binary search,"""---\r\nname: Pull request\r\nabout: Propose changes to the code\r\ntitle: ''\r\nlabels: ''\r\nassignees: ''\r\n---\r\n\r\n\r\n\r\n## 1. Are you opening this pull request for bug-fixs, optimizations or new feature?\r\n\r\nOptimization.\r\n\r\n## 2. Please describe how these code changes achieve your intention.\r\n\r\n\r\nTo avoid calculating mid overflow, see [stackoverflow](https://stackoverflow.com/questions/6735259/calculating-mid-in-binary-search) discussion.\r\n\r\n## 3. Please link to the relevant issues (if any).\r\n\r\n\r\n\r\n\r\n## 4. Which documentation changes (if any) need to be made/updated because of this PR?\r\n\r\n\r\n\r\n\r\n## 4. Checklist\r\n\r\n- [x] I have squashed all insignificant commits.\r\n- [ ] I have commented my code for explaining package types, values, functions, and non-obvious lines.\r\n- [ ] I have written unit tests and verified that all tests passes (if needed).\r\n- [ ] I have documented feature info on the README (only when this PR is adding a new feature).\r\n- [ ] (optional) I am willing to help maintain this change if there are issues with it later.\r\n""",https://github.com/panjf2000/ants/pull/198,qmdx00,github:GithubAccount:1:27898261,,198,2021-11-30T09:34:02.000+00:00,,2021-12-01T00:42:16.000+00:00,,,0a67f19748a39459ab7b84e0bb89d9314e751433,optimize-calculating-mid,master,1e897421860606afc3d1304cafe5cd187cee13e9,c038cb6a3fdb41292378e91098b5badff5adb8f4 +github:GithubPullRequest:1:816835878,github:GithubRepo:1:134018330,,closed,Add binarysearch of loop queue,"""---\r\nname: Pull request\r\nabout: Add binarysearch method to loop_queue to get expired workers, just like worker_stack.\r\ntitle: ''\r\nlabels: ''\r\nassignees: 'bright2227'\r\n---\r\n\r\n\r\n\r\n## 1. Are you opening this pull request for bug-fixs, optimizations or new feature?\r\noptimizations \r\n\r\n\r\n\r\n## 2. Please describe how these code changes achieve your intention.\r\nI found that loop_queue had an intention to use binarysearch method, just like worker_stack. But it's removed before being merged into the master branch due to some bugs. I mapped true positions to imaginary positions before using binarysearch method and also add some tests to make sure it works.\r\n\r\n\r\n## 3. Please link to the relevant issues (if any).\r\nhttps://github.com/panjf2000/ants/pull/53#pullrequestreview-299506068\r\n\r\n\r\n## 4. Which documentation changes (if any) need to be made/updated because of this PR?\r\nNo need.\r\n\r\n\r\n\r\n## 4. Checklist\r\n\r\n- [ ] I have squashed all insignificant commits.\r\n- [x] I have commented my code for explaining package types, values, functions, and non-obvious lines.\r\n- [x] I have written unit tests and verified that all tests passes (if needed).\r\n- [ ] I have documented feature info on the README (only when this PR is adding a new feature).\r\n- [x] (optional) I am willing to help maintain this change if there are issues with it later.\r\n""",https://github.com/panjf2000/ants/pull/206,bright2227,github:GithubAccount:1:64823610,,206,2022-01-08T10:06:36.000+00:00,2022-01-31T02:49:03.000+00:00,2022-01-31T02:49:03.000+00:00,,,1bd4304727b2ea62ec243f3145389d6ffe3607cf,add_binarysearch_of_loop_q,master,1e897421860606afc3d1304cafe5cd187cee13e9,1b95a084ac08cd34e247b5d3d0063778cfc14748 +github:GithubPullRequest:1:835038436,github:GithubRepo:1:134018330,,closed,Awake the blocking callers when Tune(size int) is invoked to expand the pool,"""…capacity\r\n\r\n---\r\nname: Pull request\r\nabout: Propose changes to the code\r\ntitle: 'Instantly scale up capacity when using Tune(size int) to enlarge the capacity'\r\nlabels: 'enhancement'\r\nassignees: ''\r\n---\r\n\r\n\r\n\r\n## 1. Are you opening this pull request for bug-fixs, optimizations or new feature?\r\n\r\nWhen using Tune(size int) to enlarge the capacity, create a worker immediately to perform blocking tasks.\r\n\r\n## 2. Please describe how these code changes achieve your intention.\r\n\r\n\r\n\r\n\r\n## 3. Please link to the relevant issues (if any).\r\n\r\n\r\nclose #205 \r\n\r\n\r\n## 4. Which documentation changes (if any) need to be made/updated because of this PR?\r\n\r\n\r\n\r\n\r\n## 4. Checklist\r\n\r\n- [x] I have squashed all insignificant commits.\r\n- [x] I have commented my code for explaining package types, values, functions, and non-obvious lines.\r\n- [x] I have written unit tests and verified that all tests passes (if needed).\r\n- [ ] I have documented feature info on the README (only when this PR is adding a new feature).\r\n- [x] (optional) I am willing to help maintain this change if there are issues with it later.\r\n""",https://github.com/panjf2000/ants/pull/210,codingfanlt,github:GithubAccount:1:35493957,,210,2022-01-29T08:01:24.000+00:00,2022-02-14T13:51:40.000+00:00,2022-02-14T13:51:41.000+00:00,,,fbd17036dbf5ae677ba9e41326745a65e655232f,feat/instantly-scale-up-capacity,master,0fa2fd6dc1811f81026a252854f4a8c0471ac7b0,0e17530397bcec737dd9a77fc9589a6866ec4f6e +github:GithubPullRequest:1:842184289,github:GithubRepo:1:134018330,,open,Remove worker_func.go and modify pool_func.go simplifying the library,"""---\r\nname: Remove worker_func.go and modify pool_func.go simplifying the library\r\nabout: Remove worker_func.go and modify pool_func.go to simply utilize the non-func pool+worker implementation\r\ntitle: 'Remove worker_func.go and modify pool_func.go simplifying the library'\r\nlabels: ''\r\nassignees: @panjf2000 \r\n---\r\n\r\n\r\n\r\n## 1. Are you opening this pull request for bug-fixs, optimizations or new feature?\r\n\r\nSimplifying the library\r\n\r\n## 2. Please describe how these code changes achieve your intention.\r\n\r\n\r\nWhile reading through the library it became clear to me that `PoolWithFunc` was just a specific case of `Pool`, where instead of submitting tasks, the caller simply passes arguments for a pre-defined function to be run on the workers. This means that, instead of a `chan func() interface{}` as the message queue, we use a `chan interface{}`, and IMO this shouldn't warrant a completely different `Pool` implementation.\r\n\r\nThis PR proposes the complete removal of the `worker_func.go` file, choosing instead to adapt `PoolWithFunc` to use the default `Pool`, changing `.Invoke` to simply call the underlying `Pool.Submit` method with an anonymous function wrapping `p.poolFunc(args)`, transforming it into a `goWorker` accepted task, giving us a more robust and simpler library.\r\n\r\n## 3. Please link to the relevant issues (if any).\r\n\r\n\r\n## 4. Which documentation changes (if any) need to be made/updated because of this PR?\r\n\r\n\r\nNo documentation changes are needed as this doesn't change any of API or examples used.\r\n\r\n## 4. Checklist\r\n\r\n- [x] I have squashed all insignificant commits.\r\n- [x] I have commented my code for explaining package types, values, functions, and non-obvious lines.\r\n- [x] I have written unit tests and verified that all tests passes (if needed).\r\n- [x] (optional) I am willing to help maintain this change if there are issues with it later.\r\n- ~I have documented feature info on the README (only when this PR is adding a new feature).~\r\n""",https://github.com/panjf2000/ants/pull/211,lucafmarques,github:GithubAccount:1:15234973,,211,2022-02-07T21:31:30.000+00:00,,,,,abc622e2696d0f5c1521c96dd206fc2a25c45ad4,simpler-pool-func,master,134f354e8e3ba73a35bc7da671ea6d1a8001d35d,863116682b4378fc82f00c950e5c6469c0e295bb diff --git a/plugins/github/impl/impl.go b/plugins/github/impl/impl.go index 8ade296791f..6bba76c1b0a 100644 --- a/plugins/github/impl/impl.go +++ b/plugins/github/impl/impl.go @@ -79,7 +79,7 @@ func (plugin Github) SubTaskMetas() []core.SubTaskMeta { tasks.ConvertPullRequestsMeta, tasks.ConvertPullRequestLabelsMeta, tasks.ConvertPullRequestIssuesMeta, - tasks.ConvertUsersMeta, + tasks.ConvertAccountsMeta, tasks.ConvertIssueCommentsMeta, tasks.ConvertPullRequestCommentsMeta, tasks.ConvertMilestonesMeta, diff --git a/plugins/github/models/user.go b/plugins/github/models/account.go similarity index 94% rename from plugins/github/models/user.go rename to plugins/github/models/account.go index b71af98fb3d..c3eb59d7495 100644 --- a/plugins/github/models/user.go +++ b/plugins/github/models/account.go @@ -21,7 +21,7 @@ import ( "github.com/apache/incubator-devlake/models/common" ) -type GithubUser struct { +type GithubAccount struct { ConnectionId uint64 `gorm:"primaryKey"` Id int `json:"id" gorm:"primaryKey;autoIncrement:false"` Login string `json:"login" gorm:"type:varchar(255)"` @@ -32,6 +32,6 @@ type GithubUser struct { common.NoPKModel } -func (GithubUser) TableName() string { +func (GithubAccount) TableName() string { return "_tool_github_accounts" } diff --git a/plugins/github/models/migrationscripts/archived/user.go b/plugins/github/models/migrationscripts/archived/account.go similarity index 95% rename from plugins/github/models/migrationscripts/archived/user.go rename to plugins/github/models/migrationscripts/archived/account.go index 15e55322dfc..41ff5ab4fee 100644 --- a/plugins/github/models/migrationscripts/archived/user.go +++ b/plugins/github/models/migrationscripts/archived/account.go @@ -19,7 +19,7 @@ package archived import "github.com/apache/incubator-devlake/models/migrationscripts/archived" -type GithubUser struct { +type GithubAccount struct { ConnectionId uint64 `gorm:"primaryKey"` Id int `json:"id" gorm:"primaryKey;autoIncrement:false"` Login string `json:"login" gorm:"type:varchar(255)"` @@ -30,6 +30,6 @@ type GithubUser struct { archived.NoPKModel } -func (GithubUser) TableName() string { +func (GithubAccount) TableName() string { return "_tool_github_accounts" } diff --git a/plugins/github/models/migrationscripts/init_schema_20220615.go b/plugins/github/models/migrationscripts/init_schema_20220615.go index 532bcaacff7..35473180f12 100644 --- a/plugins/github/models/migrationscripts/init_schema_20220615.go +++ b/plugins/github/models/migrationscripts/init_schema_20220615.go @@ -19,6 +19,7 @@ package migrationscripts import ( "context" + "github.com/apache/incubator-devlake/plugins/core" "github.com/apache/incubator-devlake/plugins/helper" @@ -68,7 +69,7 @@ func (u *initSchemas) Up(ctx context.Context, db *gorm.DB) error { &archived.GithubIssueComment{}, &archived.GithubIssueEvent{}, &archived.GithubIssueLabel{}, - &archived.GithubUser{}, + &archived.GithubAccount{}, &archived.GithubPullRequestIssue{}, &archived.GithubCommitStat{}, "_raw_github_api_issues", @@ -122,7 +123,7 @@ func (u *initSchemas) Up(ctx context.Context, db *gorm.DB) error { &archived.GithubIssueComment{}, &archived.GithubIssueEvent{}, &archived.GithubIssueLabel{}, - &archived.GithubUser{}, + &archived.GithubAccount{}, &archived.GithubPullRequestIssue{}, &archived.GithubCommitStat{}, ) diff --git a/plugins/github/tasks/user_convertor.go b/plugins/github/tasks/account_convertor.go similarity index 71% rename from plugins/github/tasks/user_convertor.go rename to plugins/github/tasks/account_convertor.go index 3f1bbdc9218..17cc8d67f05 100644 --- a/plugins/github/tasks/user_convertor.go +++ b/plugins/github/tasks/account_convertor.go @@ -20,38 +20,39 @@ package tasks import ( "reflect" + "github.com/apache/incubator-devlake/models/domainlayer/crossdomain" + "github.com/apache/incubator-devlake/plugins/core/dal" "github.com/apache/incubator-devlake/models/domainlayer" "github.com/apache/incubator-devlake/models/domainlayer/didgen" - "github.com/apache/incubator-devlake/models/domainlayer/user" "github.com/apache/incubator-devlake/plugins/core" githubModels "github.com/apache/incubator-devlake/plugins/github/models" "github.com/apache/incubator-devlake/plugins/helper" ) -var ConvertUsersMeta = core.SubTaskMeta{ - Name: "convertUsers", - EntryPoint: ConvertUsers, +var ConvertAccountsMeta = core.SubTaskMeta{ + Name: "convertAccounts", + EntryPoint: ConvertAccounts, EnabledByDefault: true, - Description: "Convert tool layer table github_users into domain layer table users", + Description: "Convert tool layer table github_accounts into domain layer table accounts", DomainTypes: []string{core.DOMAIN_TYPE_CROSS}, } -func ConvertUsers(taskCtx core.SubTaskContext) error { +func ConvertAccounts(taskCtx core.SubTaskContext) error { db := taskCtx.GetDal() data := taskCtx.GetData().(*GithubTaskData) - cursor, err := db.Cursor(dal.From(&githubModels.GithubUser{})) + cursor, err := db.Cursor(dal.From(&githubModels.GithubAccount{})) if err != nil { return err } defer cursor.Close() - userIdGen := didgen.NewDomainIdGenerator(&githubModels.GithubUser{}) + accountIdGen := didgen.NewDomainIdGenerator(&githubModels.GithubAccount{}) converter, err := helper.NewDataConverter(helper.DataConverterArgs{ - InputRowType: reflect.TypeOf(githubModels.GithubUser{}), + InputRowType: reflect.TypeOf(githubModels.GithubAccount{}), Input: cursor, RawDataSubTaskArgs: helper.RawDataSubTaskArgs{ Ctx: taskCtx, @@ -63,10 +64,10 @@ func ConvertUsers(taskCtx core.SubTaskContext) error { Table: RAW_COMMIT_TABLE, }, Convert: func(inputRow interface{}) ([]interface{}, error) { - githubUser := inputRow.(*githubModels.GithubUser) - domainUser := &user.User{ - DomainEntity: domainlayer.DomainEntity{Id: userIdGen.Generate(data.Options.ConnectionId, githubUser.Id)}, - Name: githubUser.Login, + githubUser := inputRow.(*githubModels.GithubAccount) + domainUser := &crossdomain.Account{ + DomainEntity: domainlayer.DomainEntity{Id: accountIdGen.Generate(data.Options.ConnectionId, githubUser.Id)}, + UserName: githubUser.Login, AvatarUrl: githubUser.AvatarUrl, } return []interface{}{ diff --git a/plugins/github/tasks/user_extractor.go b/plugins/github/tasks/account_extractor.go similarity index 90% rename from plugins/github/tasks/user_extractor.go rename to plugins/github/tasks/account_extractor.go index 8e227a23189..a7dff45fcfd 100644 --- a/plugins/github/tasks/user_extractor.go +++ b/plugins/github/tasks/account_extractor.go @@ -21,7 +21,7 @@ import ( "github.com/apache/incubator-devlake/plugins/github/models" ) -type GithubUserResponse struct { +type GithubAccountResponse struct { Login string `json:"login"` Id int `json:"id"` NodeId string `json:"node_id"` @@ -42,8 +42,8 @@ type GithubUserResponse struct { SiteAdmin bool `json:"site_admin"` } -func convertUser(res *GithubUserResponse, connId uint64) (*models.GithubUser, error) { - githubUser := &models.GithubUser{ +func convertAccount(res *GithubAccountResponse, connId uint64) (*models.GithubAccount, error) { + githubAccount := &models.GithubAccount{ ConnectionId: connId, Id: res.Id, Login: res.Login, @@ -52,5 +52,5 @@ func convertUser(res *GithubUserResponse, connId uint64) (*models.GithubUser, er HtmlUrl: res.HtmlUrl, Type: res.Type, } - return githubUser, nil + return githubAccount, nil } diff --git a/plugins/github/tasks/comment_extractor.go b/plugins/github/tasks/comment_extractor.go index 24164234aa3..4ef82c18891 100644 --- a/plugins/github/tasks/comment_extractor.go +++ b/plugins/github/tasks/comment_extractor.go @@ -40,7 +40,7 @@ var ExtractApiCommentsMeta = core.SubTaskMeta{ type IssueComment struct { GithubId int `json:"id"` Body json.RawMessage - User *GithubUserResponse + User *GithubAccountResponse IssueUrl string `json:"issue_url"` GithubCreatedAt helper.Iso8601Time `json:"created_at"` GithubUpdatedAt helper.Iso8601Time `json:"updated_at"` @@ -111,11 +111,11 @@ func ExtractApiComments(taskCtx core.SubTaskContext) error { } results = append(results, githubIssueComment) } - githubUser, err := convertUser(apiComment.User, data.Options.ConnectionId) + githubAccount, err := convertAccount(apiComment.User, data.Options.ConnectionId) if err != nil { return nil, err } - results = append(results, githubUser) + results = append(results, githubAccount) return results, nil }, }) diff --git a/plugins/github/tasks/commit_extractor.go b/plugins/github/tasks/commit_extractor.go index bebafa99592..ae4ab4bc220 100644 --- a/plugins/github/tasks/commit_extractor.go +++ b/plugins/github/tasks/commit_extractor.go @@ -37,8 +37,8 @@ type CommitsResponse struct { Sha string `json:"sha"` Commit Commit Url string - Author *models.GithubUser - Committer *models.GithubUser + Author *models.GithubAccount + Committer *models.GithubAccount } type Commit struct { diff --git a/plugins/github/tasks/event_extractor.go b/plugins/github/tasks/event_extractor.go index 9d3a66a1af5..6d89b02da9b 100644 --- a/plugins/github/tasks/event_extractor.go +++ b/plugins/github/tasks/event_extractor.go @@ -36,7 +36,7 @@ var ExtractApiEventsMeta = core.SubTaskMeta{ type IssueEvent struct { GithubId int `json:"id"` Event string - Actor *GithubUserResponse + Actor *GithubAccountResponse Issue struct { Id int } @@ -71,11 +71,11 @@ func ExtractApiEvents(taskCtx core.SubTaskContext) error { return nil, err } results = append(results, githubIssueEvent) - githubUser, err := convertUser(body.Actor, data.Options.ConnectionId) + githubAccount, err := convertAccount(body.Actor, data.Options.ConnectionId) if err != nil { return nil, err } - results = append(results, githubUser) + results = append(results, githubAccount) return results, nil }, diff --git a/plugins/github/tasks/issue_comment_convertor.go b/plugins/github/tasks/issue_comment_convertor.go index 27d57efa090..cab2455381b 100644 --- a/plugins/github/tasks/issue_comment_convertor.go +++ b/plugins/github/tasks/issue_comment_convertor.go @@ -54,7 +54,7 @@ func ConvertIssueComments(taskCtx core.SubTaskContext) error { defer cursor.Close() issueIdGen := didgen.NewDomainIdGenerator(&githubModels.GithubIssue{}) - userIdGen := didgen.NewDomainIdGenerator(&githubModels.GithubUser{}) + accountIdGen := didgen.NewDomainIdGenerator(&githubModels.GithubAccount{}) converter, err := helper.NewDataConverter(helper.DataConverterArgs{ InputRowType: reflect.TypeOf(githubModels.GithubIssueComment{}), @@ -76,7 +76,7 @@ func ConvertIssueComments(taskCtx core.SubTaskContext) error { }, IssueId: issueIdGen.Generate(data.Options.ConnectionId, githubIssueComment.IssueId), Body: githubIssueComment.Body, - UserId: userIdGen.Generate(data.Options.ConnectionId, githubIssueComment.AuthorUserId), + UserId: accountIdGen.Generate(data.Options.ConnectionId, githubIssueComment.AuthorUserId), CreatedDate: githubIssueComment.GithubCreatedAt, } return []interface{}{ diff --git a/plugins/github/tasks/issue_convertor.go b/plugins/github/tasks/issue_convertor.go index b5ebdcafa45..f22b0c57cf3 100644 --- a/plugins/github/tasks/issue_convertor.go +++ b/plugins/github/tasks/issue_convertor.go @@ -56,7 +56,7 @@ func ConvertIssues(taskCtx core.SubTaskContext) error { defer cursor.Close() issueIdGen := didgen.NewDomainIdGenerator(&githubModels.GithubIssue{}) - userIdGen := didgen.NewDomainIdGenerator(&githubModels.GithubUser{}) + accountIdGen := didgen.NewDomainIdGenerator(&githubModels.GithubAccount{}) boardIdGen := didgen.NewDomainIdGenerator(&githubModels.GithubRepo{}) converter, err := helper.NewDataConverter(helper.DataConverterArgs{ @@ -80,9 +80,9 @@ func ConvertIssues(taskCtx core.SubTaskContext) error { Description: issue.Body, Priority: issue.Priority, Type: issue.Type, - AssigneeId: userIdGen.Generate(data.Options.ConnectionId, issue.AssigneeId), + AssigneeId: accountIdGen.Generate(data.Options.ConnectionId, issue.AssigneeId), AssigneeName: issue.AssigneeName, - CreatorId: userIdGen.Generate(data.Options.ConnectionId, issue.AuthorId), + CreatorId: accountIdGen.Generate(data.Options.ConnectionId, issue.AuthorId), CreatorName: issue.AuthorName, LeadTimeMinutes: issue.LeadTimeMinutes, Url: issue.Url, diff --git a/plugins/github/tasks/issue_extractor.go b/plugins/github/tasks/issue_extractor.go index f5799c8b1bb..0e8bd712ed8 100644 --- a/plugins/github/tasks/issue_extractor.go +++ b/plugins/github/tasks/issue_extractor.go @@ -51,8 +51,8 @@ type IssuesResponse struct { Labels []struct { Name string `json:"name"` } `json:"labels"` - Assignee *GithubUserResponse - User *GithubUserResponse + Assignee *GithubAccountResponse + User *GithubAccountResponse Milestone *struct { Id int } @@ -122,14 +122,18 @@ func ExtractApiIssues(taskCtx core.SubTaskContext) error { results = append(results, githubLabels...) results = append(results, githubIssue) if body.Assignee != nil { - relatedUser, err := convertUser(body.Assignee, data.Options.ConnectionId) + githubIssue.AssigneeId = body.Assignee.Id + githubIssue.AssigneeName = body.Assignee.Login + relatedUser, err := convertAccount(body.Assignee, data.Options.ConnectionId) if err != nil { return nil, err } results = append(results, relatedUser) } if body.User != nil { - relatedUser, err := convertUser(body.User, data.Options.ConnectionId) + githubIssue.AuthorId = body.User.Id + githubIssue.AuthorName = body.User.Login + relatedUser, err := convertAccount(body.User, data.Options.ConnectionId) if err != nil { return nil, err } diff --git a/plugins/github/tasks/pr_comment_convertor.go b/plugins/github/tasks/pr_comment_convertor.go index 9bc13b6e5ee..23004a34e8d 100644 --- a/plugins/github/tasks/pr_comment_convertor.go +++ b/plugins/github/tasks/pr_comment_convertor.go @@ -54,7 +54,7 @@ func ConvertPullRequestComments(taskCtx core.SubTaskContext) error { defer cursor.Close() prIdGen := didgen.NewDomainIdGenerator(&githubModels.GithubPullRequest{}) - userIdGen := didgen.NewDomainIdGenerator(&githubModels.GithubUser{}) + accountIdGen := didgen.NewDomainIdGenerator(&githubModels.GithubAccount{}) converter, err := helper.NewDataConverter(helper.DataConverterArgs{ InputRowType: reflect.TypeOf(githubModels.GithubPullRequestComment{}), @@ -76,7 +76,7 @@ func ConvertPullRequestComments(taskCtx core.SubTaskContext) error { }, PullRequestId: prIdGen.Generate(data.Options.ConnectionId, githubPullRequestComment.PullRequestId), Body: githubPullRequestComment.Body, - UserId: userIdGen.Generate(data.Options.ConnectionId, githubPullRequestComment.AuthorUserId), + UserId: accountIdGen.Generate(data.Options.ConnectionId, githubPullRequestComment.AuthorUserId), CreatedDate: githubPullRequestComment.GithubCreatedAt, CommitSha: "", Position: 0, diff --git a/plugins/github/tasks/pr_convertor.go b/plugins/github/tasks/pr_convertor.go index b4a8e973811..f0190269f05 100644 --- a/plugins/github/tasks/pr_convertor.go +++ b/plugins/github/tasks/pr_convertor.go @@ -54,7 +54,7 @@ func ConvertPullRequests(taskCtx core.SubTaskContext) error { prIdGen := didgen.NewDomainIdGenerator(&models.GithubPullRequest{}) repoIdGen := didgen.NewDomainIdGenerator(&models.GithubRepo{}) - userIdGen := didgen.NewDomainIdGenerator(&models.GithubUser{}) + accountIdGen := didgen.NewDomainIdGenerator(&models.GithubAccount{}) converter, err := helper.NewDataConverter(helper.DataConverterArgs{ InputRowType: reflect.TypeOf(models.GithubPullRequest{}), @@ -78,7 +78,7 @@ func ConvertPullRequests(taskCtx core.SubTaskContext) error { Status: pr.State, Title: pr.Title, Url: pr.Url, - AuthorId: userIdGen.Generate(data.Options.ConnectionId, pr.AuthorId), + AuthorId: accountIdGen.Generate(data.Options.ConnectionId, pr.AuthorId), AuthorName: pr.AuthorName, Description: pr.Body, CreatedDate: pr.GithubCreatedAt, diff --git a/plugins/github/tasks/pr_extractor.go b/plugins/github/tasks/pr_extractor.go index a49e5834e65..ff42fb475a2 100644 --- a/plugins/github/tasks/pr_extractor.go +++ b/plugins/github/tasks/pr_extractor.go @@ -46,8 +46,8 @@ type GithubApiPullRequest struct { Labels []struct { Name string `json:"name"` } `json:"labels"` - Assignee *GithubUserResponse - User *GithubUserResponse + Assignee *GithubAccountResponse + User *GithubAccountResponse ClosedAt *helper.Iso8601Time `json:"closed_at"` MergedAt *helper.Iso8601Time `json:"merged_at"` GithubCreatedAt helper.Iso8601Time `json:"created_at"` @@ -118,7 +118,7 @@ func ExtractApiPullRequests(taskCtx core.SubTaskContext) error { return nil, err } if rawL.User != nil { - githubUser, err := convertUser(rawL.User, data.Options.ConnectionId) + githubUser, err := convertAccount(rawL.User, data.Options.ConnectionId) if err != nil { return nil, err } diff --git a/plugins/github/tasks/pr_review_extractor.go b/plugins/github/tasks/pr_review_extractor.go index c56ca23e776..8047727c5ec 100644 --- a/plugins/github/tasks/pr_review_extractor.go +++ b/plugins/github/tasks/pr_review_extractor.go @@ -36,7 +36,7 @@ var ExtractApiPullRequestReviewersMeta = core.SubTaskMeta{ type PullRequestReview struct { GithubId int `json:"id"` - User *GithubUserResponse + User *GithubAccountResponse Body string State string SubmittedAt helper.Iso8601Time `json:"submitted_at"` @@ -85,7 +85,7 @@ func ExtractApiPullRequestReviewers(taskCtx core.SubTaskContext) error { PullRequestId: pull.GithubId, } results = append(results, githubReviewer) - githubUser, err := convertUser(apiPullRequestReview.User, data.Options.ConnectionId) + githubUser, err := convertAccount(apiPullRequestReview.User, data.Options.ConnectionId) if err != nil { return nil, err } diff --git a/plugins/github/tasks/repo_extractor.go b/plugins/github/tasks/repo_extractor.go index dcb3366211a..70a30357f6b 100644 --- a/plugins/github/tasks/repo_extractor.go +++ b/plugins/github/tasks/repo_extractor.go @@ -42,7 +42,7 @@ type GithubApiRepo struct { HTMLUrl string `json:"html_url"` Language string `json:"language"` Description string `json:"description"` - Owner *GithubUserResponse + Owner *GithubAccountResponse Parent *GithubApiRepo `json:"parent"` CreatedAt helper.Iso8601Time `json:"created_at"` UpdatedAt *helper.Iso8601Time `json:"updated_at"` @@ -98,7 +98,7 @@ func ExtractApiRepositories(taskCtx core.SubTaskContext) error { } results = append(results, githubRepository) - githubUser, err := convertUser(body.Owner, data.Options.ConnectionId) + githubUser, err := convertAccount(body.Owner, data.Options.ConnectionId) if err != nil { return nil, err } diff --git a/plugins/gitlab/e2e/account_test.go b/plugins/gitlab/e2e/account_test.go deleted file mode 100644 index 9482a60eb03..00000000000 --- a/plugins/gitlab/e2e/account_test.go +++ /dev/null @@ -1,88 +0,0 @@ -/* -Licensed to the Apache Software Foundation (ASF) under one or more -contributor license agreements. See the NOTICE file distributed with -this work for additional information regarding copyright ownership. -The ASF licenses this file to You under the Apache License, Version 2.0 -(the "License"); you may not use this file except in compliance with -the License. You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ - -package e2e - -import ( - "fmt" - "testing" - - "github.com/apache/incubator-devlake/helpers/e2ehelper" - "github.com/apache/incubator-devlake/models/domainlayer/user" - "github.com/apache/incubator-devlake/plugins/gitlab/impl" - "github.com/apache/incubator-devlake/plugins/gitlab/models" - "github.com/apache/incubator-devlake/plugins/gitlab/tasks" -) - -func TestGitlabAccountDataFlow(t *testing.T) { - - var gitlab impl.Gitlab - dataflowTester := e2ehelper.NewDataFlowTester(t, "gitlab", gitlab) - - taskData := &tasks.GitlabTaskData{ - Options: &tasks.GitlabOptions{ - ConnectionId: 1, - ProjectId: 12345678, - }, - } - - // import raw data table - dataflowTester.ImportCsvIntoRawTable("./raw_tables/_raw_gitlab_api_users.csv", - "_raw_gitlab_api_users") - - // verify extraction - dataflowTester.FlushTabler(&models.GitlabUser{}) - dataflowTester.Subtask(tasks.ExtractUserMeta, taskData) - dataflowTester.VerifyTable( - models.GitlabUser{}, - fmt.Sprintf("./snapshot_tables/%s.csv", models.GitlabUser{}.TableName()), - []string{ - "connection_id", - "gitlab_id", - "username", - "email", - "name", - "state", - "membership_state", - "avatar_url", - "web_url", - "_raw_data_params", - "_raw_data_table", - "_raw_data_id", - "_raw_data_remark", - }, - ) - - // verify conversion - dataflowTester.FlushTabler(&user.User{}) - dataflowTester.Subtask(tasks.ConvertUsersMeta, taskData) - dataflowTester.VerifyTable( - user.User{}, - fmt.Sprintf("./snapshot_tables/%s.csv", user.User{}.TableName()), - []string{ - "id", - "_raw_data_params", - "_raw_data_table", - "_raw_data_id", - "_raw_data_remark", - "name", - "email", - "avatar_url", - "timezone", - }, - ) -} diff --git a/plugins/gitlab/e2e/raw_tables/_raw_gitlab_api_users.csv b/plugins/gitlab/e2e/raw_tables/_raw_gitlab_api_users.csv deleted file mode 100644 index b0931f41548..00000000000 --- a/plugins/gitlab/e2e/raw_tables/_raw_gitlab_api_users.csv +++ /dev/null @@ -1,15 +0,0 @@ -id,params,data,url,input,created_at -2,"{""ConnectionId"":1,""ProjectId"":12345678}","{""id"":2436773,""username"":""abc1"",""name"":""abc1"",""state"":""active"",""avatar_url"":""https://gitlab.com/uploads/-/system/user/avatar/2436773/avatar.png"",""web_url"":""https://gitlab.com/abc1"",""access_level"":50,""created_at"":""2018-10-21T01:00:32.162Z"",""created_by"":{""id"":2436773,""username"":""abc1"",""name"":""abc1"",""state"":""active"",""avatar_url"":""https://gitlab.com/uploads/-/system/user/avatar/2436773/avatar.png"",""web_url"":""https://gitlab.com/abc1""},""expires_at"":null,""membership_state"":""active""}",https://gitlab.com/api/v4/projects/12345678/members/all,null,2022-07-01 15:52:06.495 -3,"{""ConnectionId"":1,""ProjectId"":12345678}","{""id"":2994198,""username"":""abc2"",""name"":""abc2 Yin"",""state"":""active"",""avatar_url"":""https://secure.gravatar.com/avatar/69667c2c63ce892e11b9ac098e3abc4f?s=80\u0026d=identicon"",""web_url"":""https://gitlab.com/abc2"",""access_level"":50,""created_at"":""2018-10-22T14:54:36.245Z"",""created_by"":{""id"":2436773,""username"":""abc1"",""name"":""abc1"",""state"":""active"",""avatar_url"":""https://gitlab.com/uploads/-/system/user/avatar/2436773/avatar.png"",""web_url"":""https://gitlab.com/abc1""},""expires_at"":null,""membership_state"":""active""}",https://gitlab.com/api/v4/projects/12345678/members/all,null,2022-07-01 15:52:06.495 -4,"{""ConnectionId"":1,""ProjectId"":12345678}","{""id"":5767011,""username"":""abc3"",""name"":""abc3"",""state"":""active"",""avatar_url"":""https://secure.gravatar.com/avatar/ce5efe9b3acceecd4f3266fad757e6c3?s=80\u0026d=identicon"",""web_url"":""https://gitlab.com/abc3"",""access_level"":20,""created_at"":""2020-03-28T13:55:45.722Z"",""created_by"":{""id"":3466461,""username"":""abc8"",""name"":""abc2"",""state"":""active"",""avatar_url"":""https://gitlab.com/uploads/-/system/user/avatar/3466461/avatar.png"",""web_url"":""https://gitlab.com/abc8""},""expires_at"":null,""membership_state"":""active""}",https://gitlab.com/api/v4/projects/12345678/members/all,null,2022-07-01 15:52:06.495 -5,"{""ConnectionId"":1,""ProjectId"":12345678}","{""id"":4646117,""username"":""abc4"",""name"":""abc4"",""state"":""active"",""avatar_url"":""https://secure.gravatar.com/avatar/85998e06af031ec6071c64976018bcb2?s=80\u0026d=identicon"",""web_url"":""https://gitlab.com/abc4"",""access_level"":20,""created_at"":""2020-04-16T16:16:09.275Z"",""created_by"":{""id"":3466461,""username"":""abc8"",""name"":""abc2"",""state"":""active"",""avatar_url"":""https://gitlab.com/uploads/-/system/user/avatar/3466461/avatar.png"",""web_url"":""https://gitlab.com/abc8""},""expires_at"":null,""membership_state"":""active""}",https://gitlab.com/api/v4/projects/12345678/members/all,null,2022-07-01 15:52:06.495 -6,"{""ConnectionId"":1,""ProjectId"":12345678}","{""id"":4403812,""username"":""abc5"",""name"":""abc5"",""state"":""active"",""avatar_url"":""https://gitlab.com/uploads/-/system/user/avatar/4403812/avatar.png"",""web_url"":""https://gitlab.com/abc5"",""access_level"":20,""created_at"":""2020-04-23T01:02:54.558Z"",""created_by"":{""id"":3466461,""username"":""abc8"",""name"":""abc2"",""state"":""active"",""avatar_url"":""https://gitlab.com/uploads/-/system/user/avatar/3466461/avatar.png"",""web_url"":""https://gitlab.com/abc8""},""expires_at"":null,""membership_state"":""active""}",https://gitlab.com/api/v4/projects/12345678/members/all,null,2022-07-01 15:52:06.495 -7,"{""ConnectionId"":1,""ProjectId"":12345678}","{""id"":1533989,""username"":""abc6"",""name"":""abc6"",""state"":""active"",""avatar_url"":""https://gitlab.com/uploads/-/system/user/avatar/1533989/avatar.png"",""web_url"":""https://gitlab.com/abc6"",""access_level"":40,""created_at"":""2020-09-07T02:54:48.516Z"",""created_by"":{""id"":3466461,""username"":""abc8"",""name"":""abc2"",""state"":""active"",""avatar_url"":""https://gitlab.com/uploads/-/system/user/avatar/3466461/avatar.png"",""web_url"":""https://gitlab.com/abc8""},""expires_at"":null,""membership_state"":""active""}",https://gitlab.com/api/v4/projects/12345678/members/all,null,2022-07-01 15:52:06.495 -8,"{""ConnectionId"":1,""ProjectId"":12345678}","{""id"":7175839,""username"":""abc7"",""name"":""abc7"",""state"":""active"",""avatar_url"":""https://gitlab.com/uploads/-/system/user/avatar/7175839/avatar.png"",""web_url"":""https://gitlab.com/abc7"",""access_level"":30,""created_at"":""2020-09-24T06:54:25.555Z"",""created_by"":{""id"":3466461,""username"":""abc8"",""name"":""abc2"",""state"":""active"",""avatar_url"":""https://gitlab.com/uploads/-/system/user/avatar/3466461/avatar.png"",""web_url"":""https://gitlab.com/abc8""},""expires_at"":null,""membership_state"":""active""}",https://gitlab.com/api/v4/projects/12345678/members/all,null,2022-07-01 15:52:06.495 -9,"{""ConnectionId"":1,""ProjectId"":12345678}","{""id"":3466461,""username"":""abc8"",""name"":""abc2"",""state"":""active"",""avatar_url"":""https://gitlab.com/uploads/-/system/user/avatar/3466461/avatar.png"",""web_url"":""https://gitlab.com/abc8"",""access_level"":50,""created_at"":""2020-09-29T01:37:20.962Z"",""created_by"":{""id"":3466461,""username"":""abc8"",""name"":""abc2"",""state"":""active"",""avatar_url"":""https://gitlab.com/uploads/-/system/user/avatar/3466461/avatar.png"",""web_url"":""https://gitlab.com/abc8""},""expires_at"":null,""membership_state"":""active""}",https://gitlab.com/api/v4/projects/12345678/members/all,null,2022-07-01 15:52:06.495 -10,"{""ConnectionId"":1,""ProjectId"":12345678}","{""id"":7650639,""username"":""abc9"",""name"":""abc8"",""state"":""active"",""avatar_url"":""https://secure.gravatar.com/avatar/ad6525d38db5c025f249a5971f339e4b?s=80\u0026d=identicon"",""web_url"":""https://gitlab.com/abc9"",""access_level"":10,""created_at"":""2020-09-30T03:16:22.367Z"",""created_by"":{""id"":3466461,""username"":""abc8"",""name"":""abc2"",""state"":""active"",""avatar_url"":""https://gitlab.com/uploads/-/system/user/avatar/3466461/avatar.png"",""web_url"":""https://gitlab.com/abc8""},""expires_at"":null,""membership_state"":""active""}",https://gitlab.com/api/v4/projects/12345678/members/all,null,2022-07-01 15:52:06.495 -11,"{""ConnectionId"":1,""ProjectId"":12345678}","{""id"":7411593,""username"":""abc10"",""name"":""abc9"",""state"":""active"",""avatar_url"":""https://gitlab.com/uploads/-/system/user/avatar/7411593/avatar.png"",""web_url"":""https://gitlab.com/abc10"",""access_level"":40,""created_at"":""2020-10-19T02:02:06.333Z"",""created_by"":{""id"":3466461,""username"":""abc8"",""name"":""abc2"",""state"":""active"",""avatar_url"":""https://gitlab.com/uploads/-/system/user/avatar/3466461/avatar.png"",""web_url"":""https://gitlab.com/abc8""},""expires_at"":null,""membership_state"":""active""}",https://gitlab.com/api/v4/projects/12345678/members/all,null,2022-07-01 15:52:06.495 -12,"{""ConnectionId"":1,""ProjectId"":12345678}","{""id"":1678508,""username"":""abc11"",""name"":""abc10"",""state"":""active"",""avatar_url"":""https://gitlab.com/uploads/-/system/user/avatar/1678508/avatar.png"",""web_url"":""https://gitlab.com/abc11"",""access_level"":50,""created_at"":""2020-11-06T02:46:20.074Z"",""created_by"":{""id"":3466461,""username"":""abc8"",""name"":""abc2"",""state"":""active"",""avatar_url"":""https://gitlab.com/uploads/-/system/user/avatar/3466461/avatar.png"",""web_url"":""https://gitlab.com/abc8""},""expires_at"":null,""membership_state"":""active""}",https://gitlab.com/api/v4/projects/12345678/members/all,null,2022-07-01 15:52:06.495 -13,"{""ConnectionId"":1,""ProjectId"":12345678}","{""id"":7598851,""username"":""abc12"",""name"":""abc11"",""state"":""active"",""avatar_url"":""https://gitlab.com/uploads/-/system/user/avatar/7598851/avatar.png"",""web_url"":""https://gitlab.com/abc12"",""access_level"":30,""created_at"":""2020-11-09T03:26:53.580Z"",""created_by"":{""id"":3466461,""username"":""abc8"",""name"":""abc2"",""state"":""active"",""avatar_url"":""https://gitlab.com/uploads/-/system/user/avatar/3466461/avatar.png"",""web_url"":""https://gitlab.com/abc8""},""expires_at"":null,""membership_state"":""active""}",https://gitlab.com/api/v4/projects/12345678/members/all,null,2022-07-01 15:52:06.495 -14,"{""ConnectionId"":1,""ProjectId"":12345678}","{""id"":3453538,""username"":""abc13"",""name"":""abc12"",""state"":""active"",""avatar_url"":""https://secure.gravatar.com/avatar/df1654ce1e2a49ea9f84986b863bf1d1?s=80\u0026d=identicon"",""web_url"":""https://gitlab.com/abc13"",""access_level"":30,""created_at"":""2020-12-13T23:52:36.201Z"",""created_by"":{""id"":3466461,""username"":""abc8"",""name"":""abc2"",""state"":""active"",""avatar_url"":""https://gitlab.com/uploads/-/system/user/avatar/3466461/avatar.png"",""web_url"":""https://gitlab.com/abc8""},""expires_at"":null,""membership_state"":""active""}",https://gitlab.com/api/v4/projects/12345678/members/all,null,2022-07-01 15:52:06.495 -15,"{""ConnectionId"":1,""ProjectId"":12345678}","{""id"":3412597,""username"":""abc14"",""name"":""abc13"",""state"":""active"",""avatar_url"":""https://secure.gravatar.com/avatar/d1d69b6c79d3ef5f1c92022969a15485?s=80\u0026d=identicon"",""web_url"":""https://gitlab.com/abc14"",""access_level"":40,""created_at"":""2020-12-13T23:53:12.341Z"",""created_by"":{""id"":3466461,""username"":""abc8"",""name"":""abc2"",""state"":""active"",""avatar_url"":""https://gitlab.com/uploads/-/system/user/avatar/3466461/avatar.png"",""web_url"":""https://gitlab.com/abc8""},""expires_at"":null,""membership_state"":""active""}",https://gitlab.com/api/v4/projects/12345678/members/all,null,2022-07-01 15:52:06.495 diff --git a/plugins/gitlab/e2e/snapshot_tables/_tool_gitlab_accounts.csv b/plugins/gitlab/e2e/snapshot_tables/_tool_gitlab_accounts.csv deleted file mode 100644 index ec9fc9ee0da..00000000000 --- a/plugins/gitlab/e2e/snapshot_tables/_tool_gitlab_accounts.csv +++ /dev/null @@ -1,2 +0,0 @@ -connection_id,gitlab_id,username,email,name,state,membership_state,avatar_url,web_url,_raw_data_params,_raw_data_table,_raw_data_id,_raw_data_remark -1,0,abc14,,abc13,active,active,https://secure.gravatar.com/avatar/d1d69b6c79d3ef5f1c92022969a15485?s=80&d=identicon,https://gitlab.com/abc14,"{""ConnectionId"":1,""ProjectId"":12345678}",_raw_gitlab_api_users,15, diff --git a/plugins/gitlab/e2e/snapshot_tables/accounts.csv b/plugins/gitlab/e2e/snapshot_tables/accounts.csv deleted file mode 100644 index ccea67c6584..00000000000 --- a/plugins/gitlab/e2e/snapshot_tables/accounts.csv +++ /dev/null @@ -1,2 +0,0 @@ -id,_raw_data_params,_raw_data_table,_raw_data_id,_raw_data_remark,name,email,avatar_url,timezone -gitlab:GitlabUser:1:0,"{""ConnectionId"":1,""ProjectId"":12345678}",_raw_gitlab_api_users,15,,abc13,,https://secure.gravatar.com/avatar/d1d69b6c79d3ef5f1c92022969a15485?s=80&d=identicon, diff --git a/plugins/gitlab/tasks/user_convertor.go b/plugins/gitlab/tasks/user_convertor.go index 2b73f1dcfbe..66510f3770e 100644 --- a/plugins/gitlab/tasks/user_convertor.go +++ b/plugins/gitlab/tasks/user_convertor.go @@ -18,13 +18,13 @@ limitations under the License. package tasks import ( + "github.com/apache/incubator-devlake/models/domainlayer/crossdomain" "reflect" "github.com/apache/incubator-devlake/plugins/core/dal" "github.com/apache/incubator-devlake/models/domainlayer" "github.com/apache/incubator-devlake/models/domainlayer/didgen" - "github.com/apache/incubator-devlake/models/domainlayer/user" "github.com/apache/incubator-devlake/plugins/core" gitlabModels "github.com/apache/incubator-devlake/plugins/gitlab/models" "github.com/apache/incubator-devlake/plugins/helper" @@ -63,9 +63,9 @@ func ConvertUsers(taskCtx core.SubTaskContext) error { }, Convert: func(inputRow interface{}) ([]interface{}, error) { gitlabUser := inputRow.(*gitlabModels.GitlabUser) - domainUser := &user.User{ + domainUser := &crossdomain.Account{ DomainEntity: domainlayer.DomainEntity{Id: userIdGen.Generate(data.Options.ConnectionId, gitlabUser.GitlabId)}, - Name: gitlabUser.Name, + UserName: gitlabUser.Name, Email: gitlabUser.Email, AvatarUrl: gitlabUser.AvatarUrl, } diff --git a/plugins/jira/tasks/user_convertor.go b/plugins/jira/tasks/user_convertor.go index 2d547466b9c..c20aba8f955 100644 --- a/plugins/jira/tasks/user_convertor.go +++ b/plugins/jira/tasks/user_convertor.go @@ -19,8 +19,8 @@ package tasks import ( "github.com/apache/incubator-devlake/models/domainlayer" + "github.com/apache/incubator-devlake/models/domainlayer/crossdomain" "github.com/apache/incubator-devlake/models/domainlayer/didgen" - "github.com/apache/incubator-devlake/models/domainlayer/user" "github.com/apache/incubator-devlake/plugins/core" "github.com/apache/incubator-devlake/plugins/core/dal" "github.com/apache/incubator-devlake/plugins/helper" @@ -68,14 +68,13 @@ func ConvertUsers(taskCtx core.SubTaskContext) error { Input: cursor, Convert: func(inputRow interface{}) ([]interface{}, error) { jiraUser := inputRow.(*models.JiraUser) - u := &user.User{ + u := &crossdomain.Account{ DomainEntity: domainlayer.DomainEntity{ Id: userIdGen.Generate(connectionId, jiraUser.AccountId), }, - Name: jiraUser.Name, + UserName: jiraUser.Name, Email: jiraUser.Email, AvatarUrl: jiraUser.AvatarUrl, - Timezone: jiraUser.Timezone, } return []interface{}{u}, nil }, diff --git a/plugins/tapd/e2e/account_test.go b/plugins/tapd/e2e/account_test.go deleted file mode 100644 index 8425c6fb983..00000000000 --- a/plugins/tapd/e2e/account_test.go +++ /dev/null @@ -1,83 +0,0 @@ -/* -Licensed to the Apache Software Foundation (ASF) under one or more -contributor license agreements. See the NOTICE file distributed with -this work for additional information regarding copyright ownership. -The ASF licenses this file to You under the Apache License, Version 2.0 -(the "License"); you may not use this file except in compliance with -the License. You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ - -package e2e - -import ( - "fmt" - "testing" - - "github.com/apache/incubator-devlake/helpers/e2ehelper" - "github.com/apache/incubator-devlake/models/domainlayer/user" - "github.com/apache/incubator-devlake/plugins/tapd/impl" - "github.com/apache/incubator-devlake/plugins/tapd/models" - "github.com/apache/incubator-devlake/plugins/tapd/tasks" -) - -func TestTapdAccountDataFlow(t *testing.T) { - - var tapd impl.Tapd - dataflowTester := e2ehelper.NewDataFlowTester(t, "tapd", tapd) - - taskData := &tasks.TapdTaskData{ - Options: &tasks.TapdOptions{ - ConnectionId: 1, - CompanyId: 99, - WorkspaceId: 991, - }, - } - // import raw data table - dataflowTester.ImportCsvIntoRawTable("./raw_tables/_raw_tapd_api_users.csv", - "_raw_tapd_api_users") - - // verify extraction - dataflowTester.FlushTabler(&models.TapdUser{}) - dataflowTester.Subtask(tasks.ExtractUserMeta, taskData) - dataflowTester.VerifyTable( - models.TapdUser{}, - fmt.Sprintf("./snapshot_tables/%s.csv", models.TapdUser{}.TableName()), - []string{ - "connection_id", - "user", - "name", - "_raw_data_params", - "_raw_data_table", - "_raw_data_id", - "_raw_data_remark", - }, - ) - - // verify conversion{ - dataflowTester.FlushTabler(&user.User{}) - dataflowTester.Subtask(tasks.ConvertUserMeta, taskData) - dataflowTester.VerifyTable( - user.User{}, - fmt.Sprintf("./snapshot_tables/%s.csv", user.User{}.TableName()), - []string{ - "id", - "_raw_data_params", - "_raw_data_table", - "_raw_data_id", - "_raw_data_remark", - "name", - "email", - "avatar_url", - "timezone", - }, - ) - -} diff --git a/plugins/tapd/e2e/raw_tables/_raw_tapd_api_users.csv b/plugins/tapd/e2e/raw_tables/_raw_tapd_api_users.csv deleted file mode 100644 index d6329d70f56..00000000000 --- a/plugins/tapd/e2e/raw_tables/_raw_tapd_api_users.csv +++ /dev/null @@ -1,12 +0,0 @@ -"id","params","data","url","input","created_at" -"1","{""ConnectionId"":1,""CompanyId"":99,""WorkspaceId"":991}","{""UserWorkspace"":{""user"":""abc"",""role_id"":[""1000000000000000089""],""name"":""abc""}}","https://api.tapd.cn/workspaces/users?workspace_id=991","null","2022-6-21 12:13:07.951" -"2","{""ConnectionId"":1,""CompanyId"":99,""WorkspaceId"":991}","{""UserWorkspace"":{""user"":""abc1"",""role_id"":[""1000000000000000002""],""name"":""abc1""}}","https://api.tapd.cn/workspaces/users?workspace_id=991","null","2022-6-21 12:13:07.951" -"3","{""ConnectionId"":1,""CompanyId"":99,""WorkspaceId"":991}","{""UserWorkspace"":{""user"":""abc2"",""role_id"":[""1000000000000000089""],""name"":""abc2""}}","https://api.tapd.cn/workspaces/users?workspace_id=991","null","2022-6-21 12:13:07.951" -"4","{""ConnectionId"":1,""CompanyId"":99,""WorkspaceId"":991}","{""UserWorkspace"":{""user"":""abc3"",""role_id"":[""11991001000059""],""name"":""abc3""}}","https://api.tapd.cn/workspaces/users?workspace_id=991","null","2022-6-21 12:13:07.951" -"5","{""ConnectionId"":1,""CompanyId"":99,""WorkspaceId"":991}","{""UserWorkspace"":{""user"":""abc4"",""role_id"":[""1000000000000000089"",""1000000000000000002""],""name"":""abc4""}}","https://api.tapd.cn/workspaces/users?workspace_id=991","null","2022-6-21 12:13:07.951" -"6","{""ConnectionId"":1,""CompanyId"":99,""WorkspaceId"":991}","{""UserWorkspace"":{""user"":""abc5"",""role_id"":[""1000000000000000089""],""name"":""abc5""}}","https://api.tapd.cn/workspaces/users?workspace_id=991","null","2022-6-21 12:13:07.951" -"7","{""ConnectionId"":1,""CompanyId"":99,""WorkspaceId"":991}","{""UserWorkspace"":{""user"":""abc6"",""role_id"":[""1000000000000000002""],""name"":""abc6""}}","https://api.tapd.cn/workspaces/users?workspace_id=991","null","2022-6-21 12:13:07.951" -"8","{""ConnectionId"":1,""CompanyId"":99,""WorkspaceId"":991}","{""UserWorkspace"":{""user"":""abc7"",""role_id"":[""1000000000000000089""],""name"":""abc7""}}","https://api.tapd.cn/workspaces/users?workspace_id=991","null","2022-6-21 12:13:07.951" -"9","{""ConnectionId"":1,""CompanyId"":99,""WorkspaceId"":991}","{""UserWorkspace"":{""user"":""abc8"",""role_id"":[""1000000000000000089""],""name"":""abc8""}}","https://api.tapd.cn/workspaces/users?workspace_id=991","null","2022-6-21 12:13:07.951" -"10","{""ConnectionId"":1,""CompanyId"":99,""WorkspaceId"":991}","{""UserWorkspace"":{""user"":""abc9"",""role_id"":[""11991001000014""],""name"":""abc9""}}","https://api.tapd.cn/workspaces/users?workspace_id=991","null","2022-6-21 12:13:07.951" -"11","{""ConnectionId"":1,""CompanyId"":99,""WorkspaceId"":991}","{""UserWorkspace"":{""user"":""abc10"",""role_id"":[""1000000000000000089""],""name"":""abc10""}}","https://api.tapd.cn/workspaces/users?workspace_id=991","null","2022-6-21 12:13:07.951" diff --git a/plugins/tapd/e2e/snapshot_tables/_tool_tapd_accounts.csv b/plugins/tapd/e2e/snapshot_tables/_tool_tapd_accounts.csv deleted file mode 100644 index ef100c5e9f5..00000000000 --- a/plugins/tapd/e2e/snapshot_tables/_tool_tapd_accounts.csv +++ /dev/null @@ -1,12 +0,0 @@ -connection_id,user,name,_raw_data_params,_raw_data_table,_raw_data_id,_raw_data_remark -1,abc,abc,"{""ConnectionId"":1,""CompanyId"":99,""WorkspaceId"":991}",_raw_tapd_api_users,1, -1,abc1,abc1,"{""ConnectionId"":1,""CompanyId"":99,""WorkspaceId"":991}",_raw_tapd_api_users,2, -1,abc10,abc10,"{""ConnectionId"":1,""CompanyId"":99,""WorkspaceId"":991}",_raw_tapd_api_users,11, -1,abc2,abc2,"{""ConnectionId"":1,""CompanyId"":99,""WorkspaceId"":991}",_raw_tapd_api_users,3, -1,abc3,abc3,"{""ConnectionId"":1,""CompanyId"":99,""WorkspaceId"":991}",_raw_tapd_api_users,4, -1,abc4,abc4,"{""ConnectionId"":1,""CompanyId"":99,""WorkspaceId"":991}",_raw_tapd_api_users,5, -1,abc5,abc5,"{""ConnectionId"":1,""CompanyId"":99,""WorkspaceId"":991}",_raw_tapd_api_users,6, -1,abc6,abc6,"{""ConnectionId"":1,""CompanyId"":99,""WorkspaceId"":991}",_raw_tapd_api_users,7, -1,abc7,abc7,"{""ConnectionId"":1,""CompanyId"":99,""WorkspaceId"":991}",_raw_tapd_api_users,8, -1,abc8,abc8,"{""ConnectionId"":1,""CompanyId"":99,""WorkspaceId"":991}",_raw_tapd_api_users,9, -1,abc9,abc9,"{""ConnectionId"":1,""CompanyId"":99,""WorkspaceId"":991}",_raw_tapd_api_users,10, diff --git a/plugins/tapd/tasks/user_converter.go b/plugins/tapd/tasks/user_converter.go index 65bcff1984c..1d0bc36d160 100644 --- a/plugins/tapd/tasks/user_converter.go +++ b/plugins/tapd/tasks/user_converter.go @@ -18,11 +18,11 @@ limitations under the License. package tasks import ( + "github.com/apache/incubator-devlake/models/domainlayer/crossdomain" "reflect" "github.com/apache/incubator-devlake/models/domainlayer" "github.com/apache/incubator-devlake/models/domainlayer/didgen" - "github.com/apache/incubator-devlake/models/domainlayer/user" "github.com/apache/incubator-devlake/plugins/core" "github.com/apache/incubator-devlake/plugins/core/dal" "github.com/apache/incubator-devlake/plugins/helper" @@ -49,11 +49,11 @@ func ConvertUser(taskCtx core.SubTaskContext) error { Input: cursor, Convert: func(inputRow interface{}) ([]interface{}, error) { userTool := inputRow.(*models.TapdUser) - issue := &user.User{ + issue := &crossdomain.Account{ DomainEntity: domainlayer.DomainEntity{ Id: userIdGen.Generate(data.Options.ConnectionId, userTool.User), }, - Name: userTool.Name, + UserName: userTool.Name, } return []interface{}{ @@ -72,5 +72,5 @@ var ConvertUserMeta = core.SubTaskMeta{ Name: "convertUser", EntryPoint: ConvertUser, EnabledByDefault: true, - Description: "convert Tapd User", + Description: "convert Tapd Account", }