-
Notifications
You must be signed in to change notification settings - Fork 20
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
fix: fail on non-success gohbem init #254
base: main
Are you sure you want to change the base?
Conversation
Fixes it in the sense that it exits if the pokemon data cannot be download? (And I assume therefore potentially goes into a restart loop?) Should it instead try again in a short while while keeping golbat up? |
Thought about that as well.. This would cause no-pvp data at all for at least 20-30 minutes until retry?! :) this "fail on loading pokemon data" could be caused if e.g. not sure which fix would be better :( so you suggest to retry after 1-2 minutes? :) |
I'm not sure either. I've summarised the options as I see them:
Probably (3) is the most attractive |
I looked at the gohbem code and it has a function to load from disk already, so the whole download/save to golbat cache/load from disk/refresh on interval could move into golbat code. |
I saw there is also a |
We're probably best just doing it in golbat. We can try to download, if we succeed write to the file. |
Probably this needs to update gohbem as well.... The masterfile watcher is fetching new data each hour by default.... This update would need to trigger a write to cache .... |
As per my description above I think golbat should have the timer, so the download, write the file and gohbem should be told to load from the cache file using the existing load from file function it has. |
Since everything is already in Gohbem I see no point to moving a logic to Golbat. For now, I have added a proposal of the ability to set up a path to auto update a MasterFile from within a watcher routine in Gohbem. https://github.com/UnownHash/gohbem/pull/16/files Gohbem have few methods we can use to achieve it:
If that works for you, all we need is to make a few changes in Golbat. Right now we call only a Fetch and Watch. if err := o.FetchPokemonData(); err != nil {
log.Errorf("ohbem.FetchPokemonData: %s", err)
return
}
_ = o.WatchPokemonData() So when it can't fetch a MasterFile for whatever reason, it will fail. To avoid that, we could store MasterFile under Golbat cache directory in git and load it This would make sure it won't fail initial run anymore. In worst case we will have outdated data till Gohbem will be able to fetch updated version, and once it will success we will have the newest MasterFile in cache for a case when restart is issued and initial pull won't work. |
e404649
to
68bbdfd
Compare
Since we don't provide any MF within repo https://github.com/UnownHash/Golbat/pull/254/files#diff-9a386635a8469bbef0ef8310a20497399a96bd3773f865d237ad6a407f84a53cR202 this should be fatal I think. |
See my comment in gohbem for logic to load a provided master file - it should be in a separate folder from the cache written one to avoid git issues |
I don't think we should copy something from different repo into this, maybe a git submodule would work for that case, will have a look tomorrow |
It doesn’t really matter how out of date it is since in the default case it won’t be used, and a separate copy protects against failure / corruption of the (unmaintained now) source. |
d12d018
to
047c685
Compare
047c685
to
73c987b
Compare
fixes #214