fix(migration): todoist pagination now avoids too many loops
This commit is contained in:
parent
0cd9cd324e
commit
682123a9c9
@ -226,6 +226,9 @@ func insertFromStructure(s *xorm.Session, str []*models.NamespaceWithListsAndTas
|
||||
// If not, create one and save it for later
|
||||
var lb *models.Label
|
||||
var exists bool
|
||||
if label == nil {
|
||||
continue
|
||||
}
|
||||
lb, exists = labels[label.Title+label.HexColor]
|
||||
if !exists {
|
||||
err = label.Create(s, user)
|
||||
|
@ -35,6 +35,8 @@ import (
|
||||
"code.vikunja.io/api/pkg/utils"
|
||||
)
|
||||
|
||||
const paginationLimit = 200
|
||||
|
||||
// Migration is the todoist migration struct
|
||||
type Migration struct {
|
||||
Code string `json:"code"`
|
||||
@ -554,7 +556,7 @@ func (m *Migration) Migrate(u *user.User) (err error) {
|
||||
doneItems := make(map[string]*doneItem)
|
||||
|
||||
for {
|
||||
resp, err = migration.DoPostWithHeaders("https://api.todoist.com/sync/v9/completed/get_all?limit=200&offset="+strconv.Itoa(offset), form, bearerHeader)
|
||||
resp, err = migration.DoPostWithHeaders("https://api.todoist.com/sync/v9/completed/get_all?limit="+strconv.Itoa(paginationLimit)+"&offset="+strconv.Itoa(offset*paginationLimit), form, bearerHeader)
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user