Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-pages.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--internal/serving/disk/zip/serving.go7
1 files changed, 5 insertions, 2 deletions
diff --git a/internal/serving/disk/zip/serving.go b/internal/serving/disk/zip/serving.go
index b552050c..61d186da 100644
--- a/internal/serving/disk/zip/serving.go
+++ b/internal/serving/disk/zip/serving.go
@@ -1,6 +1,8 @@
package zip
import (
+ "sync"
+
"gitlab.com/gitlab-org/gitlab-pages/internal/config"
"gitlab.com/gitlab-org/gitlab-pages/internal/serving"
"gitlab.com/gitlab-org/gitlab-pages/internal/serving/disk"
@@ -9,13 +11,14 @@ import (
)
var instance serving.Serving
+var once sync.Once
// Instance returns a serving instance that is capable of reading files
// from a zip archives opened from a URL, most likely stored in object storage
func Instance() serving.Serving {
- if instance == nil {
+ once.Do(func() {
instance = disk.New(vfs.Instrumented(zip.New(config.Default.Zip)))
- }
+ })
return instance
}