fiqus / coophub

Cooperatives repos over the world! 🌈🌎
https://coophub.io
MIT License
57 stars 28 forks source link

[bug] ArithmeticError when calculating repo popularity #131

Closed diegomanuel closed 1 year ago

diegomanuel commented 1 year ago

We have an error that is happening always at the same org/repos when refreshing the entire cache. This is causing to keep retriying to update and may deplete the daily requests cap we can issue to github api.

[error] Task #PID<0.4270.0> started from #PID<0.4265.0> terminating
** (ArithmeticError) bad argument in arithmetic expression
    (coophub 0.5.0) lib/coophub/repos.ex:165: Coophub.Repos.get_repo_popularity/1
    (coophub 0.5.0) lib/coophub/cache_warmer.ex:231: anonymous fn/1 in Coophub.CacheWarmer.put_popularities/1
    (elixir 1.12.3) lib/enum.ex:1582: Enum."-map/2-lists^map/1-0-"/2
    (coophub 0.5.0) lib/coophub/cache_warmer.ex:214: Coophub.CacheWarmer.get_org_with_repos/2
    (elixir 1.12.3) lib/enum.ex:1586: anonymous fn/3 in Enum.map/2
    (stdlib 3.17.1) maps.erl:410: :maps.fold_1/3
    (elixir 1.12.3) lib/enum.ex:2397: Enum.map/2
    (elixir 1.12.3) lib/task/supervised.ex:90: Task.Supervised.invoke_mfa/2
Function: #Function<14.67629458/0 in Coophub.CacheWarmer.warm_cache/0>
    Args: []
diegomanuel commented 1 year ago

The fix didn't work, the bug is still there! :point_up:

diegomanuel commented 1 year ago

The fix DID work! Just needed to create a new release+deploy :beers: