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

manager: support checkpoint #75

Merged
merged 2 commits into from
Jan 4, 2021
Merged

manager: support checkpoint #75

merged 2 commits into from
Jan 4, 2021

Conversation

skyzh
Copy link
Member

@skyzh skyzh commented Dec 31, 2020

No description provided.

@skyzh skyzh changed the title support checkpoint manager: support checkpoint Dec 31, 2020
pkg/manager/manager.go Outdated Show resolved Hide resolved
}
return &newManager, nil
}

func (m *Manager) checkpoint() error {
file, _ := json.MarshalIndent(m.workersLastInvokeTime, "", " ")
err := ioutil.WriteFile(m.config.Checkpoint, file, 0644)
Copy link
Contributor

Choose a reason for hiding this comment

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

perhaps we should use atomic file write here like https://pkg.go.dev/github.com/siddontang/go/ioutil2#WriteFileAtomic (though that implementation missed a f.sync() before f.close()).

pkg/manager/manager.go Show resolved Hide resolved
@skyzh skyzh requested a review from htfy96 January 4, 2021 02:43
@skyzh skyzh merged commit 50c6f68 into master Jan 4, 2021
@skyzh skyzh deleted the add-checkpoint branch January 4, 2021 02:50
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.

2 participants