From be0ee0601925a36049015db931e3e0025a62cf4d Mon Sep 17 00:00:00 2001 From: Marius Grigoriu Date: Wed, 31 Aug 2016 15:20:25 -0700 Subject: [PATCH 1/5] remove size limit in toListPosgres to accomodate users with access to many repositories --- store/datastore/utils.go | 4 ---- 1 file changed, 4 deletions(-) diff --git a/store/datastore/utils.go b/store/datastore/utils.go index 1d4ca8b7e..aa697c0d8 100644 --- a/store/datastore/utils.go +++ b/store/datastore/utils.go @@ -57,10 +57,6 @@ func toList(listof []*model.RepoLite) (string, []interface{}) { // to a sql IN statement compatible with postgres. func toListPosgres(listof []*model.RepoLite) (string, []interface{}) { var size = len(listof) - if size > 999 { - size = 999 - listof = listof[:999] - } var qs = make([]string, size, size) var in = make([]interface{}, size, size) for i, repo := range listof { From 0ace6aefd69d825daf1a4d15e2968261262d86ec Mon Sep 17 00:00:00 2001 From: Marius Grigoriu Date: Fri, 2 Sep 2016 04:24:32 -0700 Subject: [PATCH 2/5] remove size limit in toList --- store/datastore/utils.go | 4 ---- 1 file changed, 4 deletions(-) diff --git a/store/datastore/utils.go b/store/datastore/utils.go index aa697c0d8..dacc6d226 100644 --- a/store/datastore/utils.go +++ b/store/datastore/utils.go @@ -40,10 +40,6 @@ func rebind(query string) string { // to a sql IN statment. func toList(listof []*model.RepoLite) (string, []interface{}) { var size = len(listof) - if size > 999 { - size = 999 - listof = listof[:999] - } var qs = make([]string, size, size) var in = make([]interface{}, size, size) for i, repo := range listof { From d8d0e47d011b0e0b6f921e158fc9062dda2fbcc5 Mon Sep 17 00:00:00 2001 From: Marius Grigoriu Date: Fri, 2 Sep 2016 04:32:17 -0700 Subject: [PATCH 3/5] fix typo in toListPosgres --- store/datastore/repos.go | 2 +- store/datastore/users.go | 4 ++-- store/datastore/utils.go | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/store/datastore/repos.go b/store/datastore/repos.go index 6d053ca56..c0e5c6490 100644 --- a/store/datastore/repos.go +++ b/store/datastore/repos.go @@ -28,7 +28,7 @@ func (db *datastore) GetRepoListOf(listof []*model.RepoLite) ([]*model.Repo, err ) switch meddler.Default { case meddler.PostgreSQL: - stmt, args = toListPosgres(listof) + stmt, args = toListPostgres(listof) default: stmt, args = toList(listof) } diff --git a/store/datastore/users.go b/store/datastore/users.go index 39dde54e9..0fe8d668f 100644 --- a/store/datastore/users.go +++ b/store/datastore/users.go @@ -35,7 +35,7 @@ func (db *datastore) GetUserFeed(listof []*model.RepoLite) ([]*model.Feed, error ) switch meddler.Default { case meddler.PostgreSQL: - stmt, args = toListPosgres(listof) + stmt, args = toListPostgres(listof) default: stmt, args = toList(listof) } @@ -55,7 +55,7 @@ func (db *datastore) GetUserFeedLatest(listof []*model.RepoLite) ([]*model.Feed, ) switch meddler.Default { case meddler.PostgreSQL: - stmt, args = toListPosgres(listof) + stmt, args = toListPostgres(listof) default: stmt, args = toList(listof) } diff --git a/store/datastore/utils.go b/store/datastore/utils.go index dacc6d226..79153f760 100644 --- a/store/datastore/utils.go +++ b/store/datastore/utils.go @@ -51,7 +51,7 @@ func toList(listof []*model.RepoLite) (string, []interface{}) { // helper function that converts a simple repository list // to a sql IN statement compatible with postgres. -func toListPosgres(listof []*model.RepoLite) (string, []interface{}) { +func toListPostgres(listof []*model.RepoLite) (string, []interface{}) { var size = len(listof) var qs = make([]string, size, size) var in = make([]interface{}, size, size) From e436db0862d2477efb3c7db45f579f1f5bc49816 Mon Sep 17 00:00:00 2001 From: Joachim Hill-Grannec Date: Sat, 4 Feb 2017 18:45:25 -0800 Subject: [PATCH 4/5] temp fix to increase size on non SQLite db --- store/datastore/utils.go | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/store/datastore/utils.go b/store/datastore/utils.go index 79153f760..0a0ce27db 100644 --- a/store/datastore/utils.go +++ b/store/datastore/utils.go @@ -40,6 +40,14 @@ func rebind(query string) string { // to a sql IN statment. func toList(listof []*model.RepoLite) (string, []interface{}) { var size = len(listof) + switch { + case meddler.Default == meddler.SQLite && size > 999: + size = 999 + listof = listof[:999] + case size > 15000: + size = 15000 + listof = listof[:15000] + } var qs = make([]string, size, size) var in = make([]interface{}, size, size) for i, repo := range listof { @@ -53,6 +61,14 @@ func toList(listof []*model.RepoLite) (string, []interface{}) { // to a sql IN statement compatible with postgres. func toListPostgres(listof []*model.RepoLite) (string, []interface{}) { var size = len(listof) + switch { + case meddler.Default == meddler.SQLite && size > 999: + size = 999 + listof = listof[:999] + case size > 15000: + size = 15000 + listof = listof[:15000] + } var qs = make([]string, size, size) var in = make([]interface{}, size, size) for i, repo := range listof { From 488ce878b33c58a6825b2177e67077e8aa6bd8af Mon Sep 17 00:00:00 2001 From: Joachim Hill-Grannec Date: Sat, 11 Feb 2017 12:12:34 -0800 Subject: [PATCH 5/5] =?UTF-8?q?Doesn=E2=80=99t=20need=20to=20check=20for?= =?UTF-8?q?=20SQLite=20again=20the=20the=20Progres=20list?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- store/datastore/utils.go | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/store/datastore/utils.go b/store/datastore/utils.go index 0a0ce27db..e2345dd32 100644 --- a/store/datastore/utils.go +++ b/store/datastore/utils.go @@ -61,11 +61,7 @@ func toList(listof []*model.RepoLite) (string, []interface{}) { // to a sql IN statement compatible with postgres. func toListPostgres(listof []*model.RepoLite) (string, []interface{}) { var size = len(listof) - switch { - case meddler.Default == meddler.SQLite && size > 999: - size = 999 - listof = listof[:999] - case size > 15000: + if size > 15000 { size = 15000 listof = listof[:15000] }