williamboman/mason.nvim

When two registry releases are publised on the same day, older version is downloaded by mason.nvim

Closed this issue · 5 comments

I've searched open issues for similar requests

  • Yes

I've recently downloaded the latest plugin version of mason.nvim

  • Yes

Problem description

I'm managing https://github.com/nvim-java/mason-registry repository for releasing java related packages. I use fork of this (s1n7ax/mason-registry) to test out changes before releasing. However, I have noticed when there are multiple release on the same day, It always downloads the older release. In following example I have v1.0.0 being picked. Even if I had lets say two automatic releases on the same day, it picks the older version.

image

I tried deleting the downloaded registry from /home/s1n7ax/.local/share/nvim/mason/registries/github/s1n7ax/mason-registry

Expected behavior

Get the latest release version from the registry releases

Steps to reproduce

  1. Create a fork of the main registry
  2. Change the version of a package
  3. push the changes
  4. change the registry path when setting mason.nvim (You should get the changed version)
  5. once again, change the version of the package to something else
  6. remove the registry cache
  7. re-open neovim (you should get the package version released by the last commit, but package will pick the older version so actual behavior is, mason will not update the package)

Neovim version (>= 0.7)

NVIM v0.10.0-dev-df1795c
Build type: Release
LuaJIT 2.1.1693350652

Operating system/version

Linux s1n7ax 6.1.77 #1-NixOS SMP PREEMPT_DYNAMIC Mon Feb 5 20:13:03 UTC 2024 x86_64 GNU/Linux

Healthcheck output

mason: require("mason.health").check()

mason.nvim ~
- OK mason.nvim version v1.10.0
- OK PATH: prepend
- OK Providers: 
    mason.providers.registry-api
    mason.providers.client
- OK neovim version >= 0.7.0

mason.nvim [Registries] ~
- OK Registry `github.com/s1n7ax/mason-registry version: v1.0.0` is installed.
- OK Registry `github.com/mason-org/mason-registry version: 2024-03-01-final-waste` is installed.

mason.nvim [Core utils] ~
- OK unzip: `UnZip 6.00 of 20 April 2009, by Info-ZIP.  Maintained by C. Spieler.  Send`
- WARNING wget: not available
  - ADVICE:
    - spawn: wget failed with exit code - and signal -. wget is not executable
- OK curl: `curl 8.4.0 (x86_64-pc-linux-gnu) libcurl/8.4.0 OpenSSL/3.0.12 zlib/1.3 brotli/1.1.0 zstd/1.5.5 libidn2/2.3.4 libssh2/1.11.0 nghttp2/1.57.0`
- OK gzip: `gzip 1.13`
- OK tar: `tar (GNU tar) 1.35`
- OK bash: `GNU bash, version 5.2.15(1)-release (x86_64-pc-linux-gnu)`
- OK sh: `Ok`

mason.nvim [Languages] ~
- WARNING Go: not available
  - ADVICE:
    - spawn: go failed with exit code - and signal -. go is not executable
- WARNING Composer: not available
  - ADVICE:
    - spawn: composer failed with exit code - and signal -. composer is not executable
- WARNING PHP: not available
  - ADVICE:
    - spawn: php failed with exit code - and signal -. php is not executable
- WARNING luarocks: not available
  - ADVICE:
    - spawn: luarocks failed with exit code - and signal -. luarocks is not executable
- OK node: `v21.6.2`
- OK cargo: `cargo 1.75.0`
- OK Ruby: `ruby 3.1.4p223 (2023-03-30 revision 957bb7cb81) [x86_64-linux]`
- WARNING julia: not available
  - ADVICE:
    - spawn: julia failed with exit code - and signal -. julia is not executable
- OK python: `Python 3.11.7`
- OK java: `openjdk version "17.0.7" 2023-04-18`
- OK RubyGem: `3.5.5`
- OK javac: `javac 17.0.7`
- OK npm: `10.2.4`
- OK pip: `pip 23.3.1 from /nix/store/pi2d35p8cdpljx2rg5ssd7zn0zbga6yw-python3-3.11.7-env/lib/python3.11/site-packages/pip (python 3.11)`
- OK python venv: `Ok`

mason.nvim [GitHub] ~
- OK GitHub API rate limit. Used: 0. Remaining: 60. Limit: 60. Reset: Fri 01 Mar 2024 10:39:09 AM +0530.
  Install and authenticate via gh-cli to increase rate limit.

Screenshots

No response

This might be a delay in github release cache? Because, after few minutes this got fixed without any changes.

Reopening. Even though https://github.com/USER/PROJECT/releases/latest navigates me to the latest release in the browser when mason.nvim force refreshed, it downloads an older version of mason registry from github. It still might be the cache from github but just opening this to make sure you are using USER/PROJECT/releases/latest to get the newest registry from releases.

Yet another release, same behavior. Even when /releases/latest redirects me to the latest release correctly, mason nvim still fetching an older version even when I manually remove the entire ~/.local/share/nvim/mason/registries directory.

It took exactly 30 minutes for new changes to show up. Looks like some caching mechanism to me?

Hey so this was due to how caching was configured in the API service. Only mason-org/mason-registry had low cache expirations while other repositories defaulted to 30 minute expiration. This should be fixed via mason-org/mason-registry-api#158.