mirror of
https://github.com/drakkan/sftpgo.git
synced 2025-12-08 07:10:56 +03:00
allow building with bolt provider disabled
Signed-off-by: Nicola Murino <nicola.murino@gmail.com>
This commit is contained in:
10
.github/workflows/docker.yml
vendored
10
.github/workflows/docker.yml
vendored
@@ -117,21 +117,21 @@ jobs:
|
|||||||
OPTIONAL_DEPS: ${{ matrix.optional_deps }}
|
OPTIONAL_DEPS: ${{ matrix.optional_deps }}
|
||||||
|
|
||||||
- name: Set up QEMU
|
- name: Set up QEMU
|
||||||
uses: docker/setup-qemu-action@v1
|
uses: docker/setup-qemu-action@v2
|
||||||
|
|
||||||
- name: Set up builder
|
- name: Set up builder
|
||||||
uses: docker/setup-buildx-action@v1
|
uses: docker/setup-buildx-action@v2
|
||||||
id: builder
|
id: builder
|
||||||
|
|
||||||
- name: Login to Docker Hub
|
- name: Login to Docker Hub
|
||||||
uses: docker/login-action@v1
|
uses: docker/login-action@v2
|
||||||
with:
|
with:
|
||||||
username: ${{ secrets.DOCKERHUB_USERNAME }}
|
username: ${{ secrets.DOCKERHUB_USERNAME }}
|
||||||
password: ${{ secrets.DOCKERHUB_TOKEN }}
|
password: ${{ secrets.DOCKERHUB_TOKEN }}
|
||||||
if: ${{ github.event_name != 'pull_request' }}
|
if: ${{ github.event_name != 'pull_request' }}
|
||||||
|
|
||||||
- name: Login to GitHub Container Registry
|
- name: Login to GitHub Container Registry
|
||||||
uses: docker/login-action@v1
|
uses: docker/login-action@v2
|
||||||
with:
|
with:
|
||||||
registry: ghcr.io
|
registry: ghcr.io
|
||||||
username: ${{ github.repository_owner }}
|
username: ${{ github.repository_owner }}
|
||||||
@@ -139,7 +139,7 @@ jobs:
|
|||||||
if: ${{ github.event_name != 'pull_request' }}
|
if: ${{ github.event_name != 'pull_request' }}
|
||||||
|
|
||||||
- name: Build and push
|
- name: Build and push
|
||||||
uses: docker/build-push-action@v2
|
uses: docker/build-push-action@v3
|
||||||
with:
|
with:
|
||||||
context: .
|
context: .
|
||||||
builder: ${{ steps.builder.outputs.name }}
|
builder: ${{ steps.builder.outputs.name }}
|
||||||
|
|||||||
@@ -9,7 +9,6 @@ import (
|
|||||||
"errors"
|
"errors"
|
||||||
"fmt"
|
"fmt"
|
||||||
"path/filepath"
|
"path/filepath"
|
||||||
"sync/atomic"
|
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
bolt "go.etcd.io/bbolt"
|
bolt "go.etcd.io/bbolt"
|
||||||
@@ -25,7 +24,6 @@ const (
|
|||||||
)
|
)
|
||||||
|
|
||||||
var (
|
var (
|
||||||
lastUserUpdate int64
|
|
||||||
usersBucket = []byte("users")
|
usersBucket = []byte("users")
|
||||||
groupsBucket = []byte("groups")
|
groupsBucket = []byte("groups")
|
||||||
foldersBucket = []byte("folders")
|
foldersBucket = []byte("folders")
|
||||||
@@ -2381,14 +2379,6 @@ func (p *BoltProvider) getFoldersBucket(tx *bolt.Tx) (*bolt.Bucket, error) {
|
|||||||
return bucket, err
|
return bucket, err
|
||||||
}
|
}
|
||||||
|
|
||||||
func setLastUserUpdate() {
|
|
||||||
atomic.StoreInt64(&lastUserUpdate, util.GetTimeAsMsSinceEpoch(time.Now()))
|
|
||||||
}
|
|
||||||
|
|
||||||
func getLastUserUpdate() int64 {
|
|
||||||
return atomic.LoadInt64(&lastUserUpdate)
|
|
||||||
}
|
|
||||||
|
|
||||||
func getBoltDatabaseVersion(dbHandle *bolt.DB) (schemaVersion, error) {
|
func getBoltDatabaseVersion(dbHandle *bolt.DB) (schemaVersion, error) {
|
||||||
var dbVersion schemaVersion
|
var dbVersion schemaVersion
|
||||||
err := dbHandle.View(func(tx *bolt.Tx) error {
|
err := dbHandle.View(func(tx *bolt.Tx) error {
|
||||||
|
|||||||
@@ -2,6 +2,7 @@ package dataprovider
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"fmt"
|
"fmt"
|
||||||
|
"sync/atomic"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
"github.com/robfig/cron/v3"
|
"github.com/robfig/cron/v3"
|
||||||
@@ -14,6 +15,9 @@ import (
|
|||||||
var (
|
var (
|
||||||
scheduler *cron.Cron
|
scheduler *cron.Cron
|
||||||
lastCachesUpdate int64
|
lastCachesUpdate int64
|
||||||
|
// used for bolt and memory providers, so we avoid iterating all users
|
||||||
|
// to find recently modified ones
|
||||||
|
lastUserUpdate int64
|
||||||
)
|
)
|
||||||
|
|
||||||
func stopScheduler() {
|
func stopScheduler() {
|
||||||
@@ -82,3 +86,11 @@ func checkCacheUpdates() {
|
|||||||
lastCachesUpdate = checkTime
|
lastCachesUpdate = checkTime
|
||||||
providerLog(logger.LevelDebug, "end caches check, new update time %v", util.GetTimeFromMsecSinceEpoch(lastCachesUpdate))
|
providerLog(logger.LevelDebug, "end caches check, new update time %v", util.GetTimeFromMsecSinceEpoch(lastCachesUpdate))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func setLastUserUpdate() {
|
||||||
|
atomic.StoreInt64(&lastUserUpdate, util.GetTimeAsMsSinceEpoch(time.Now()))
|
||||||
|
}
|
||||||
|
|
||||||
|
func getLastUserUpdate() int64 {
|
||||||
|
return atomic.LoadInt64(&lastUserUpdate)
|
||||||
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user