gcalcli icon indicating copy to clipboard operation
gcalcli copied to clipboard

Cache does not seem to be getting used in my macOS environment

Open sideshowbarker opened this issue 10 months ago • 5 comments

I have gcalcli installed and working as expected — except that the cache does not seem to be getting used. nothing seems to be getting cached.

Steps to reproduce

Install gcalcli per the instructions in the repo. Run a few gcalcli commands. Notice that the responses always come back relatively slowly (~4–6 seconds in my environment) — indicating that the responses are not getting served from the cache but instead gcalcli is sending new requests over the network each time.

Check the ~/Library/Application Support/gcalcli/ directory and notice there’s no cache there.

Expected behavior

A cache should be found in the ~/Library/Application Support/gcalcli/ directory, and responses should be getting served from the cache rather than gcalcli sending new requests over the network each time.

Actual behavior

There is a cache in the ~/Library/Application Support/gcalcli/ directory, but responses do not seem to be getting served from the cache; instead, gcalcli seems to be sending new requests over the network each time. And the cache does not seem to ever be getting updated.

Fixing

I’m still investigating and trying to isolate how this could be fixed in the code, and I’d be willing to contribute a patch myself for fixing it — if/when I do manage to figure it out on my own.

But if somebody else manages to find and fix it first, that’d be great too 😀

sideshowbarker avatar Jan 21 '25 00:01 sideshowbarker

@sideshowbarker oh, did you figure out the problem?

dbarnett avatar Jan 24 '25 15:01 dbarnett

Hi @dbarnett — I didn’t actually get it figured out. I initially closed it because — despite what I said the issue description — I found that I did in fact have a ~/Library/Application Support/gcalcli/cache file.

However, I subsequently found that that case file never seems to get updated.

Every time I run gcalcli agenda, it takes 4–6 seconds to respond. And when I check my network while it’s running, I see that it’s hitting the network every single time.

I’ve not yet been able to do any useful troubleshooting to try to isolate what might be going wrong. But I’ll go ahead and reopen this in the meantime.

sideshowbarker avatar Jan 24 '25 18:01 sideshowbarker

Which version are you running?

Try gcalcli util reset-cache if you have a new enough version to support it. Probably won't fix anything but maybe it would at least get a clear error message if something is broken with the cache file.

dbarnett avatar Jan 24 '25 22:01 dbarnett

Running gcalcli util reset-cache deletes the cache as expected — without emitting any errors or anything else than just Deleting cache file from /Users/mike/Library/Application Support/gcalcli/cache....

After running gcalcli agenda, I see the cache file gets recreated — but then every subsequent gcalcli agenda invocation takes roughly the same amount of time (4–6 seconds) as the first one after resetting the cache did.

sideshowbarker avatar Jan 25 '25 11:01 sideshowbarker

Which version are you running?

The latest, I think:

$ gcalcli --version
gcalcli 4.5.1

…installed from brew:

$ which gcalcli
/opt/homebrew/bin/gcalcli

sideshowbarker avatar Jan 28 '25 06:01 sideshowbarker