Skip to content
Snippets Groups Projects
Commit 7f63517d authored by Travis Ralston's avatar Travis Ralston
Browse files

Don't estimate datastore size when there's only one datastore

parent 788be302
No related branches found
No related tags found
No related merge requests found
...@@ -21,6 +21,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), ...@@ -21,6 +21,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
* GIFs now thumbnail correctly. Thanks @Sorunome! * GIFs now thumbnail correctly. Thanks @Sorunome!
* Fixed empty Content-Type header on retrieved remote media. Thanks @silkeh! * Fixed empty Content-Type header on retrieved remote media. Thanks @silkeh!
* Fixed various issues with IPv6 handling. Thanks @silkeh! * Fixed various issues with IPv6 handling. Thanks @silkeh!
* Fixed high database usage for uploads when only one datastore is present.
## [1.1.3] - July 15th, 2020 ## [1.1.3] - July 15th, 2020
......
...@@ -94,7 +94,6 @@ func GetUriForDatastore(dsConf config.DatastoreConfig) string { ...@@ -94,7 +94,6 @@ func GetUriForDatastore(dsConf config.DatastoreConfig) string {
} }
func PickDatastore(forKind string, ctx rcontext.RequestContext) (*DatastoreRef, error) { func PickDatastore(forKind string, ctx rcontext.RequestContext) (*DatastoreRef, error) {
// If we haven't found a legacy option, pick a datastore
ctx.Log.Info("Finding a suitable datastore to pick for " + forKind) ctx.Log.Info("Finding a suitable datastore to pick for " + forKind)
confDatastores := ctx.Config.DataStores confDatastores := ctx.Config.DataStores
mediaStore := storage.GetDatabase().GetMediaStore(ctx) mediaStore := storage.GetDatabase().GetMediaStore(ctx)
...@@ -122,9 +121,13 @@ func PickDatastore(forKind string, ctx rcontext.RequestContext) (*DatastoreRef, ...@@ -122,9 +121,13 @@ func PickDatastore(forKind string, ctx rcontext.RequestContext) (*DatastoreRef,
continue continue
} }
size, err := estimatedDatastoreSize(ds, ctx) var size int64
if err != nil {
continue if len(confDatastores) > 1 {
size, err = estimatedDatastoreSize(ds, ctx)
if err != nil {
continue
}
} }
if targetDs == nil || size < dsSize { if targetDs == nil || size < dsSize {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment