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

It is wrong to save empty available versions as cache when connection failed #16

Open
zhangkaizhao opened this issue Sep 7, 2024 · 0 comments

Comments

@zhangkaizhao
Copy link

connection failed:

% curl -v https://nodejs.org/dist/index.json
* Host nodejs.org:443 was resolved.
* IPv6: 2606:4700:10::6814:162e, 2606:4700:10::6814:172e
* IPv4: 104.20.23.46, 104.20.22.46
*   Trying 104.20.23.46:443...
*   Trying [2606:4700:10::6814:162e]:443...
* Immediate connect fail for 2606:4700:10::6814:162e: No route to host
*   Trying [2606:4700:10::6814:172e]:443...
* Immediate connect fail for 2606:4700:10::6814:172e: No route to host
* connect to 104.20.23.46 port 443 from 192.168.31.38 port 58385 failed: Operation timed out
*   Trying 104.20.22.46:443...
* connect to 104.20.22.46 port 443 from 192.168.31.38 port 58395 failed: Operation timed out
* Failed to connect to nodejs.org port 443 after 150188 ms: Couldn't connect to server
* Closing connection
curl: (28) Failed to connect to nodejs.org port 443 after 150188 ms: Couldn't connect to server

but vfox with nodejs plugin saves empty available versions as cache:

% rm -f .version-fox/plugin/nodejs/available.cache
% vfox --debug search nodejs
CallFunction: Available
Available hook cache duration: 12h
Available hook cache key: empty, hit: false 
# -> NOTE: here wait for a long time to timeout
no available version
% hexyl .version-fox/plugin/nodejs/available.cache 
┌────────┬─────────────────────────┬─────────────────────────┬────────┬────────┐
│00000000│ 0f ff 81 04 01 02 ff 82 ┊ 00 01 0c 01 ff 80 00 00 │•×ו••××┊⋄•_•××⋄⋄│
│00000010│ 1e 7f 03 01 02 ff 80 00 ┊ 01 02 01 03 56 61 6c 01 │•••••××⋄┊••••Val•│
│00000020│ 0a 00 01 06 45 78 70 69 ┊ 72 65 01 04 00 00 00 19 │_⋄••Expi┊re••⋄⋄⋄•│
│00000030│ ff 82 00 01 05 65 6d 70 ┊ 74 79 01 02 5b 5d 01 f8 │××⋄••emp┊ty••[]•×│
│00000040│ 2f e6 61 57 93 68 6f c0 ┊ 00                      │/×aW×ho×┊⋄       │
└────────┴─────────────────────────┴─────────────────────────┴────────┴────────┘
% vfox --debug search nodejs                      
CallFunction: Available
Available hook cache duration: 12h
Available hook cache key: empty, hit: true 
# -> NOTE: here now use available cache immediately
no available version

nodejs plugin info:

% vfox info nodejs
Plugin Info:
Name     -> nodejs
Version  -> 0.3.0
Homepage -> https://github.com/version-fox/vfox-nodejs
Desc     ->
Node.js runtime environment.
Legacy Files -> [.node-version .nvmrc]

expected:
Just show error output and no need to save anything as cache when connection failed.

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

No branches or pull requests

1 participant