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

Use empty hash fallback when loading state file in replicate-changesets #724

Merged

Conversation

AntonKhorev
Copy link
Contributor

If I use readme at https://github.com/zerebubuth/openstreetmap-changeset-replication as a guide, it says "a state file, which can be empty the first time it's used". But that's not going to work because an empty file is read as nil, then the code tries to access elements of that nil and crashes.

Here I change an empty state_file to be read as an empty hash.

@tomhughes
Copy link
Member

In practice though it's probably necessary to create one manually to bootstrap - we didn't start from the first changeset when we started publishing the changeset replication feed for example.

What does the code actually do when given an empty hash? Start replicating from the first changeset?

@AntonKhorev
Copy link
Contributor Author

I didn't get the code fully working yet, there are utc vs local timezone issues. But looks like it won't start from the first changeset.

@tomhughes
Copy link
Member

I guess this can't do any harm anyway.

@tomhughes tomhughes merged commit e4330da into openstreetmap:master Jan 9, 2025
102 checks passed
@AntonKhorev AntonKhorev deleted the safe-load-state-fallback branch January 10, 2025 09:32
@AntonKhorev
Copy link
Contributor Author

It starts replicating from current time.

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