[PR #1879] [MERGED] refactor: open boltdb only while using it #2168

Closed
opened 2026-03-01 21:54:18 +03:00 by kerem · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/nektos/act/pull/1879
Author: @ChristopherHX
Created: 6/25/2023
Status: Merged
Merged: 7/10/2023
Merged by: @mergify[bot]

Base: masterHead: boltdb-lock-in-handler


📝 Commits (10+)

📊 Changes

2 files changed (+83 additions, -42 deletions)

View changed files

📝 pkg/artifactcache/handler.go (+79 -40)
📝 pkg/artifactcache/handler_test.go (+4 -2)

📄 Description

I don't know anything about boltdb, but running two act instances with the same bolt database returns after 5s with error timeout.

My proposal is open the db on demand. Additionally close the db during download, upload and commit to reduce hitting a 5s timeout due to large caches.

Do you know any other solution?
This might have a negative impact for a single act instance, due to additional open and close calls.

Does boltdb have any problem when calling Close() twice? If so we need to disable the defered Close() after calling it.

Timeout is now 50s to allow using cache in parallel on slower devices, since database locks might take longer.

Closes #1825


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/nektos/act/pull/1879 **Author:** [@ChristopherHX](https://github.com/ChristopherHX) **Created:** 6/25/2023 **Status:** ✅ Merged **Merged:** 7/10/2023 **Merged by:** [@mergify[bot]](https://github.com/apps/mergify) **Base:** `master` ← **Head:** `boltdb-lock-in-handler` --- ### 📝 Commits (10+) - [`a87f85f`](https://github.com/nektos/act/commit/a87f85fbbee38143beff5b0d2337c3fb0c2a4e0d) refactor: open boltdb only while using it - [`2c42fff`](https://github.com/nektos/act/commit/2c42fff956bf995f84824ec8e9dd9182a2d50dd1) patch - [`2edba96`](https://github.com/nektos/act/commit/2edba96276771fa3c2d4e9469df2cb30b55b5c28) Update handler_test.go - [`dc86141`](https://github.com/nektos/act/commit/dc86141f720a9536ca1a6f043e5c44b0d65e2eff) Update handler_test.go - [`b874083`](https://github.com/nektos/act/commit/b87408363592abd20f4f57e5b6c4315ac40275f0) Update handler_test.go - [`afe0e8e`](https://github.com/nektos/act/commit/afe0e8ef78800371fedccaba94c33c017c096c43) Update handler.go - [`2119a66`](https://github.com/nektos/act/commit/2119a66655c17f9f379a5030bad4f0be5a41f387) timeout * 10 - [`c937f87`](https://github.com/nektos/act/commit/c937f87be6eebc0540ac1abe1ae86a38364e775c) Merge branch 'master' into boltdb-lock-in-handler - [`5911237`](https://github.com/nektos/act/commit/5911237ce9617821b92c7bf21f1689acfa16b36f) pr feedback - [`8b995f8`](https://github.com/nektos/act/commit/8b995f816a83c2ee5c203e7ee2a34d5088e735ae) fixup ### 📊 Changes **2 files changed** (+83 additions, -42 deletions) <details> <summary>View changed files</summary> 📝 `pkg/artifactcache/handler.go` (+79 -40) 📝 `pkg/artifactcache/handler_test.go` (+4 -2) </details> ### 📄 Description I don't know anything about boltdb, but running two act instances with the same bolt database returns after 5s with error timeout. My proposal is open the db on demand. Additionally close the db during download, upload and commit to reduce hitting a 5s timeout due to large caches. Do you know any other solution? This might have a negative impact for a single act instance, due to additional open and close calls. Does boltdb have any problem when calling Close() twice? If so we need to disable the defered Close() after calling it. ~~Timeout is now 50s to allow using cache in parallel on slower devices, since database locks might take longer.~~ Closes #1825 --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
kerem 2026-03-01 21:54:18 +03:00
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/act#2168
No description provided.