Skip to content
New issue

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

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

Already on GitHub? Sign in to your account

add goroutine to update taskinfo #236

Merged
merged 1 commit into from
Jun 15, 2022
Merged

Conversation

veeding
Copy link
Contributor

@veeding veeding commented Jun 14, 2022

solve issue228

@CLAassistant
Copy link

CLAassistant commented Jun 14, 2022

CLA assistant check
All committers have signed the CLA.

go func() {
for {
select {
case <-time.After(100 * time.Millisecond):
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It might be better to use time.Ticker?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

And it's need to update every 100 millisecond ?

}
result.Total = int64(len(result.List))
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I thank it is not the total of record in db.

Copy link
Contributor

@veezhang veezhang left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@@ -93,6 +93,21 @@ func Import(taskID string, conf *importconfig.YAMLConfig) (err error) {
}

task, _ := GetTaskMgr().GetTask(taskID)
signal := make(chan struct{}, 1)
go func() {
ticker := time.NewTicker(2 * time.Second)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Add defer ticker.Stop ?

Comment on lines 50 to 54
tx := t.Model(&TaskInfo{}).Where("nebula_address = ? And user = ?", nebulaAddress, user)
tx.Count(&count)
if err := tx.Offset((pageIndex - 1) * pageSize).Limit(pageSize).Find(&tasks).Error; err != nil {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Have you test it?

Copy link
Contributor

@veezhang veezhang left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@veezhang veezhang merged commit 58f76ca into vesoft-inc:master Jun 15, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants