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

Improve caching when fetching capabilities. #780

Merged
merged 3 commits into from
Jul 25, 2024

Conversation

fancycode
Copy link
Member

  • Honor "max-age" in "Cache-Control" header.
  • Use "ETag" to avoid fetching unmodified data.

@nickvergessen I could not find where it is set, but Nextcloud seems to always include an "cache-control: max-age=60" header. I'd rather use the caching headers as set by the server instead of hardcoding a cache time of 1 hour.

@coveralls
Copy link

coveralls commented Jul 24, 2024

Pull Request Test Coverage Report for Build 10088939132

Details

  • 103 of 125 (82.4%) changed or added relevant lines in 1 file are covered.
  • 10 unchanged lines in 2 files lost coverage.
  • Overall coverage increased (+0.1%) to 57.308%

Changes Missing Coverage Covered Lines Changed/Added Lines %
capabilities.go 103 125 82.4%
Files with Coverage Reduction New Missed Lines %
capabilities.go 3 82.73%
client.go 7 72.54%
Totals Coverage Status
Change from base Build 10077388196: 0.1%
Covered Lines: 9798
Relevant Lines: 17097

💛 - Coveralls

@nickvergessen
Copy link
Contributor

I could not find where it is set, but Nextcloud seems to always include an "cache-control: max-age=60" header.

I think this the fallback via htaccess/nginx config?
Don't see it in PHP code

@fancycode
Copy link
Member Author

I think this the fallback via htaccess/nginx config? Don't see it in PHP code

Thanks, that explains why I could not find it.

Looks like there was a suggestion to set a default cache policy expires 1m in the past that got removed in nextcloud/documentation#5857 (which I have locally set in my nginx).

So I will assume none will be sent by default in recent setups. Should I just honor that and check for the capabilities whenever needed (using If-None-Match and the ETag) or should I forcefully cache the capabilities for some time?

@nickvergessen
Copy link
Contributor

Either way is fine I guess.

@fancycode fancycode force-pushed the capabilities-cache-control branch from 1a32dff to 25cfad7 Compare July 25, 2024 05:58
@fancycode
Copy link
Member Author

Ok, so I'll honor the Cache-Control header if one is set, otherwise I will use a default cache duration of one minute to avoid overloading a Nextcloud backend if many participants join at the same time.

@fancycode fancycode merged commit 262a3bf into master Jul 25, 2024
19 checks passed
@fancycode fancycode deleted the capabilities-cache-control branch July 25, 2024 06:05
@fancycode fancycode mentioned this pull request Jul 25, 2024
mwalbeck pushed a commit to mwalbeck/docker-nextcloud-spreed-signaling that referenced this pull request Sep 13, 2024
This PR contains the following updates:

| Package | Update | Change |
|---|---|---|
| [strukturag/nextcloud-spreed-signaling](https://github.com/strukturag/nextcloud-spreed-signaling) | major | `v1.3.2` -> `v2.0.0` |

---

### Release Notes

<details>
<summary>strukturag/nextcloud-spreed-signaling (strukturag/nextcloud-spreed-signaling)</summary>

### [`v2.0.0`](https://github.com/strukturag/nextcloud-spreed-signaling/releases/tag/v2.0.0)

[Compare Source](strukturag/nextcloud-spreed-signaling@v1.3.2...v2.0.0)

##### Added

-   Federation support  [#&#8203;776](strukturag/nextcloud-spreed-signaling#776)
-   CI: Add job to update generated files.  [#&#8203;790](strukturag/nextcloud-spreed-signaling#790)
-   Expose backend session limits through prometheus stats.  [#&#8203;792](strukturag/nextcloud-spreed-signaling#792)
-   CI: Test with Golang 1.23  [#&#8203;805](strukturag/nextcloud-spreed-signaling#805)

##### Changed

-   Keep generated files in the repository.  [#&#8203;781](strukturag/nextcloud-spreed-signaling#781)
-   Improve caching when fetching capabilities.  [#&#8203;780](strukturag/nextcloud-spreed-signaling#780)
-   Enforce a minimum duration to cache capabilities.  [#&#8203;783](strukturag/nextcloud-spreed-signaling#783)
-   docs: Use the latest LTS of Ubuntu and Python 3.12.  [#&#8203;791](strukturag/nextcloud-spreed-signaling#791)
-   CI: Push generated code from service account.  [#&#8203;793](strukturag/nextcloud-spreed-signaling#793)
-   CI: Only build code if token exists (i.e. with Dependabot).  [#&#8203;794](strukturag/nextcloud-spreed-signaling#794)
-   CI: Always do a full build of generated files.  [#&#8203;795](strukturag/nextcloud-spreed-signaling#795)
-   Remove compatibility code for Go < 1.21.  [#&#8203;806](strukturag/nextcloud-spreed-signaling#806)
-   Send ping requests to local instance for federated sessions.  [#&#8203;808](strukturag/nextcloud-spreed-signaling#808)

##### Dependencies

-   Bump sphinx from 7.3.7 to 7.4.4 in /docs  [#&#8203;773](strukturag/nextcloud-spreed-signaling#773)
-   Bump google.golang.org/grpc from 1.64.0 to 1.65.0  [#&#8203;769](strukturag/nextcloud-spreed-signaling#769)
-   Bump sphinx from 7.4.4 to 7.4.5 in /docs  [#&#8203;774](strukturag/nextcloud-spreed-signaling#774)
-   Bump github.com/nats-io/nats-server/v2 from 2.10.17 to 2.10.18  [#&#8203;775](strukturag/nextcloud-spreed-signaling#775)
-   Bump sphinx from 7.4.5 to 7.4.6 in /docs  [#&#8203;777](strukturag/nextcloud-spreed-signaling#777)
-   Bump sphinx from 7.4.6 to 7.4.7 in /docs  [#&#8203;779](strukturag/nextcloud-spreed-signaling#779)
-   Bump the etcd group with 4 updates  [#&#8203;778](strukturag/nextcloud-spreed-signaling#778)
-   Bump golangci/golangci-lint-action from 6.0.1 to 6.1.0  [#&#8203;788](strukturag/nextcloud-spreed-signaling#788)
-   Bump google.golang.org/grpc/cmd/protoc-gen-go-grpc from 1.4.0 to 1.5.1  [#&#8203;784](strukturag/nextcloud-spreed-signaling#784)
-   Bump markdown from 3.6 to 3.7 in /docs  [#&#8203;801](strukturag/nextcloud-spreed-signaling#801)
-   Bump github.com/prometheus/client_golang from 1.19.1 to 1.20.2  [#&#8203;803](strukturag/nextcloud-spreed-signaling#803)
-   Bump golang from 1.22-alpine to 1.23-alpine in /docker/server  [#&#8203;798](strukturag/nextcloud-spreed-signaling#798)
-   Bump golang from 1.22-alpine to 1.23-alpine in /docker/proxy  [#&#8203;799](strukturag/nextcloud-spreed-signaling#799)
-   Bump google.golang.org/grpc from 1.65.0 to 1.66.0  [#&#8203;810](strukturag/nextcloud-spreed-signaling#810)
-   Bump github.com/nats-io/nats-server/v2 from 2.10.18 to 2.10.19  [#&#8203;809](strukturag/nextcloud-spreed-signaling#809)
-   Bump github.com/nats-io/nats.go from 1.36.0 to 1.37.0  [#&#8203;797](strukturag/nextcloud-spreed-signaling#797)
-   Bump mkdocs from 1.6.0 to 1.6.1 in /docs  [#&#8203;812](strukturag/nextcloud-spreed-signaling#812)
-   Bump github.com/nats-io/nats-server/v2 from 2.10.19 to 2.10.20  [#&#8203;813](strukturag/nextcloud-spreed-signaling#813)

</details>

---

### Configuration

📅 **Schedule**: Branch creation - At any time (no schedule defined), Automerge - At any time (no schedule defined).

🚦 **Automerge**: Disabled by config. Please merge this manually once you are satisfied.

♻ **Rebasing**: Whenever PR becomes conflicted, or you tick the rebase/retry checkbox.

🔕 **Ignore**: Close this PR and you won't be reminded about this update again.

---

 - [ ] <!-- rebase-check -->If you want to rebase/retry this PR, check this box

---

This PR has been generated by [Renovate Bot](https://github.com/renovatebot/renovate).
<!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiIzOC41OS4zIiwidXBkYXRlZEluVmVyIjoiMzguNTkuMyIsInRhcmdldEJyYW5jaCI6Im1hc3RlciIsImxhYmVscyI6W119-->

Reviewed-on: https://git.walbeck.it/walbeck-it/docker-nextcloud-spreed-signaling/pulls/504
Co-authored-by: renovate-bot <[email protected]>
Co-committed-by: renovate-bot <[email protected]>
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

Successfully merging this pull request may close these issues.

3 participants