mirror of
https://github.com/woodpecker-ci/woodpecker.git
synced 2024-11-26 20:01:02 +00:00
Merge pull request #1929 from josmo/remove_size_limit
Remove size limit
This commit is contained in:
commit
f9770b04f2
3 changed files with 12 additions and 8 deletions
|
@ -28,7 +28,7 @@ func (db *datastore) GetRepoListOf(listof []*model.RepoLite) ([]*model.Repo, err
|
||||||
)
|
)
|
||||||
switch meddler.Default {
|
switch meddler.Default {
|
||||||
case meddler.PostgreSQL:
|
case meddler.PostgreSQL:
|
||||||
stmt, args = toListPosgres(listof)
|
stmt, args = toListPostgres(listof)
|
||||||
default:
|
default:
|
||||||
stmt, args = toList(listof)
|
stmt, args = toList(listof)
|
||||||
}
|
}
|
||||||
|
|
|
@ -35,7 +35,7 @@ func (db *datastore) GetUserFeed(listof []*model.RepoLite) ([]*model.Feed, error
|
||||||
)
|
)
|
||||||
switch meddler.Default {
|
switch meddler.Default {
|
||||||
case meddler.PostgreSQL:
|
case meddler.PostgreSQL:
|
||||||
stmt, args = toListPosgres(listof)
|
stmt, args = toListPostgres(listof)
|
||||||
default:
|
default:
|
||||||
stmt, args = toList(listof)
|
stmt, args = toList(listof)
|
||||||
}
|
}
|
||||||
|
@ -55,7 +55,7 @@ func (db *datastore) GetUserFeedLatest(listof []*model.RepoLite) ([]*model.Feed,
|
||||||
)
|
)
|
||||||
switch meddler.Default {
|
switch meddler.Default {
|
||||||
case meddler.PostgreSQL:
|
case meddler.PostgreSQL:
|
||||||
stmt, args = toListPosgres(listof)
|
stmt, args = toListPostgres(listof)
|
||||||
default:
|
default:
|
||||||
stmt, args = toList(listof)
|
stmt, args = toList(listof)
|
||||||
}
|
}
|
||||||
|
|
|
@ -40,9 +40,13 @@ func rebind(query string) string {
|
||||||
// to a sql IN statment.
|
// to a sql IN statment.
|
||||||
func toList(listof []*model.RepoLite) (string, []interface{}) {
|
func toList(listof []*model.RepoLite) (string, []interface{}) {
|
||||||
var size = len(listof)
|
var size = len(listof)
|
||||||
if size > 999 {
|
switch {
|
||||||
|
case meddler.Default == meddler.SQLite && size > 999:
|
||||||
size = 999
|
size = 999
|
||||||
listof = listof[:999]
|
listof = listof[:999]
|
||||||
|
case size > 15000:
|
||||||
|
size = 15000
|
||||||
|
listof = listof[:15000]
|
||||||
}
|
}
|
||||||
var qs = make([]string, size, size)
|
var qs = make([]string, size, size)
|
||||||
var in = make([]interface{}, size, size)
|
var in = make([]interface{}, size, size)
|
||||||
|
@ -55,11 +59,11 @@ func toList(listof []*model.RepoLite) (string, []interface{}) {
|
||||||
|
|
||||||
// helper function that converts a simple repository list
|
// helper function that converts a simple repository list
|
||||||
// to a sql IN statement compatible with postgres.
|
// 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 size = len(listof)
|
||||||
if size > 999 {
|
if size > 15000 {
|
||||||
size = 999
|
size = 15000
|
||||||
listof = listof[:999]
|
listof = listof[:15000]
|
||||||
}
|
}
|
||||||
var qs = make([]string, size, size)
|
var qs = make([]string, size, size)
|
||||||
var in = make([]interface{}, size, size)
|
var in = make([]interface{}, size, size)
|
||||||
|
|
Loading…
Reference in a new issue