[#1415] lens/explorer: Add timeout for opening database
All checks were successful
DCO action / DCO (pull_request) Successful in 1m8s
Vulncheck / Vulncheck (pull_request) Successful in 2m12s
Pre-commit hooks / Pre-commit (pull_request) Successful in 2m23s
Build / Build Components (pull_request) Successful in 2m30s
Tests and linters / Lint (pull_request) Successful in 2m45s
Tests and linters / Run gofumpt (pull_request) Successful in 2m56s
Tests and linters / gopls check (pull_request) Successful in 3m15s
Tests and linters / Staticcheck (pull_request) Successful in 3m31s
Tests and linters / Tests (pull_request) Successful in 4m5s
Tests and linters / Tests with -race (pull_request) Successful in 7m23s

Signed-off-by: Aleksey Savchuk <a.savchuk@yadro.com>
This commit is contained in:
Aleksey Savchuk 2024-10-07 18:32:26 +03:00
parent a5de74a249
commit 70eac25d4a
No known key found for this signature in database
3 changed files with 6 additions and 0 deletions

View file

@ -3,6 +3,7 @@ package blobovnicza
import ( import (
"context" "context"
"fmt" "fmt"
"time"
common "git.frostfs.info/TrueCloudLab/frostfs-node/cmd/frostfs-lens/internal" common "git.frostfs.info/TrueCloudLab/frostfs-node/cmd/frostfs-lens/internal"
schema "git.frostfs.info/TrueCloudLab/frostfs-node/cmd/frostfs-lens/internal/schema/blobovnicza" schema "git.frostfs.info/TrueCloudLab/frostfs-node/cmd/frostfs-lens/internal/schema/blobovnicza"
@ -71,6 +72,7 @@ func runTUI(cmd *cobra.Command) error {
func openDB(writable bool) (*bbolt.DB, error) { func openDB(writable bool) (*bbolt.DB, error) {
db, err := bbolt.Open(vPath, 0o600, &bbolt.Options{ db, err := bbolt.Open(vPath, 0o600, &bbolt.Options{
ReadOnly: !writable, ReadOnly: !writable,
Timeout: 100 * time.Microsecond,
}) })
if err != nil { if err != nil {
return nil, err return nil, err

View file

@ -3,6 +3,7 @@ package meta
import ( import (
"context" "context"
"fmt" "fmt"
"time"
common "git.frostfs.info/TrueCloudLab/frostfs-node/cmd/frostfs-lens/internal" common "git.frostfs.info/TrueCloudLab/frostfs-node/cmd/frostfs-lens/internal"
schema "git.frostfs.info/TrueCloudLab/frostfs-node/cmd/frostfs-lens/internal/schema/metabase" schema "git.frostfs.info/TrueCloudLab/frostfs-node/cmd/frostfs-lens/internal/schema/metabase"
@ -74,6 +75,7 @@ func runTUI(cmd *cobra.Command) error {
func openDB(writable bool) (*bbolt.DB, error) { func openDB(writable bool) (*bbolt.DB, error) {
db, err := bbolt.Open(vPath, 0o600, &bbolt.Options{ db, err := bbolt.Open(vPath, 0o600, &bbolt.Options{
ReadOnly: !writable, ReadOnly: !writable,
Timeout: 100 * time.Microsecond,
}) })
if err != nil { if err != nil {
return nil, err return nil, err

View file

@ -3,6 +3,7 @@ package writecache
import ( import (
"context" "context"
"fmt" "fmt"
"time"
common "git.frostfs.info/TrueCloudLab/frostfs-node/cmd/frostfs-lens/internal" common "git.frostfs.info/TrueCloudLab/frostfs-node/cmd/frostfs-lens/internal"
schema "git.frostfs.info/TrueCloudLab/frostfs-node/cmd/frostfs-lens/internal/schema/writecache" schema "git.frostfs.info/TrueCloudLab/frostfs-node/cmd/frostfs-lens/internal/schema/writecache"
@ -71,6 +72,7 @@ func runTUI(cmd *cobra.Command) error {
func openDB(writable bool) (*bbolt.DB, error) { func openDB(writable bool) (*bbolt.DB, error) {
db, err := bbolt.Open(vPath, 0o600, &bbolt.Options{ db, err := bbolt.Open(vPath, 0o600, &bbolt.Options{
ReadOnly: !writable, ReadOnly: !writable,
Timeout: 100 * time.Microsecond,
}) })
if err != nil { if err != nil {
return nil, err return nil, err