Skip to content

Commit

Permalink
Make the scan debounce delay configurable. Disable for integration tests
Browse files Browse the repository at this point in the history
  • Loading branch information
aduffeck committed Aug 1, 2024
1 parent e459139 commit 2079a37
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 1 deletion.
2 changes: 2 additions & 0 deletions pkg/storage/fs/posix/options/options.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,8 @@ type Options struct {

UseSpaceGroups bool `mapstructure:"use_space_groups"`

ScanDebounceDelay int `mapstructure:"scan_debounce_delay"`

WatchFS bool `mapstructure:"watch_fs"`
WatchType string `mapstructure:"watch_type"`
WatchPath string `mapstructure:"watch_path"`
Expand Down
5 changes: 5 additions & 0 deletions pkg/storage/fs/posix/tree/assimilation.go
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,11 @@ func NewScanDebouncer(d time.Duration, f func(item scanItem)) *ScanDebouncer {

// Debounce restarts the debounce timer for the given space
func (d *ScanDebouncer) Debounce(item scanItem) {
if d.after == 0 {
d.f(item)
return
}

d.mutex.Lock()
defer d.mutex.Unlock()

Expand Down
2 changes: 1 addition & 1 deletion pkg/storage/fs/posix/tree/tree.go
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ func New(lu node.PathLookup, bs Blobstore, um usermapper.Mapper, trashbin *trash
idCache: cache,
propagator: propagator.New(lu, &o.Options),
scanQueue: scanQueue,
scanDebouncer: NewScanDebouncer(1000*time.Millisecond, func(item scanItem) {
scanDebouncer: NewScanDebouncer(time.Duration(o.ScanDebounceDelay)*time.Millisecond, func(item scanItem) {
scanQueue <- item
}),
es: es,
Expand Down
2 changes: 2 additions & 0 deletions tests/oc-integration-tests/drone/storage-users-posixfs.toml
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ treetime_accounting = true
treesize_accounting = true
personalspacepath_template = "users/{{.User.Username}}"
generalspacepath_template = "projects/{{.SpaceId}}"
watch_fs = true

[grpc.services.storageprovider.drivers.posix.filemetadatacache]
cache_store = "noop"
Expand All @@ -48,6 +49,7 @@ root = "/drone/src/tmp/reva/data"
permissionssvc = "localhost:10000"
treetime_accounting = true
treesize_accounting = true
scan_debounce_delay = 0

[http.services.dataprovider.drivers.posix.idcache]
cache_store = "redis"
Expand Down

0 comments on commit 2079a37

Please sign in to comment.