]> source.dussan.org Git - gitea.git/commit
Increase `cacheContextLifetime` to reduce false reports (#32011)
authorJason Song <i@wolfogre.com>
Mon, 9 Sep 2024 04:51:25 +0000 (12:51 +0800)
committerGitHub <noreply@github.com>
Mon, 9 Sep 2024 04:51:25 +0000 (04:51 +0000)
commita323a82ec4bde6ae39b97200439829bf67c0d31e
tree7df1e3a67576bcf0d88ab96399cef7436489545d
parent972eae358db0c20bda23833ca94b4324d6d343cb
Increase `cacheContextLifetime` to reduce false reports (#32011)

Replace #32001.

To prevent the context cache from being misused for long-term work
(which would result in using invalid cache without awareness), the
context cache is designed to exist for a maximum of 10 seconds. This
leads to many false reports, especially in the case of slow SQL.

This PR increases it to 5 minutes to reduce false reports.

5 minutes is not a very safe value, as a lot of changes may have
occurred within that time frame. However, as far as I know, there has
not been a case of misuse of context cache discovered so far, so I think
5 minutes should be OK.

Please note that after this PR, if warning logs are found again, it
should get attention, at that time it can be almost 100% certain that it
is a misuse.
modules/cache/context.go
modules/cache/context_test.go