fix: update readwise example to work without duplicating nodes

this is a workaround to the fact that readwise use cursor pagination
instead of offset pagination, proper handling will be added later
This commit is contained in:
Alexander Navarro 2024-12-02 09:34:12 -03:00
parent 92c9814e2a
commit 8f424d45f7
8 changed files with 42 additions and 9 deletions

View file

@ -114,7 +114,7 @@ func (collection *Collection) FetchNodes(
collection.childs = slices.Concat(collection.childs, values)
fmt.Printf("Nodes: %v\n", len(collection.childs))
fmt.Printf("Nodes added: %d, Nodes in collection: %d\n", len(values), len(collection.childs))
err = BulkCreateNode(collection._conn, values)
if err != nil {

View file

@ -133,7 +133,6 @@ func fetchWithPagination[T any](
current_page += page_offset
for current_page <= start_pagination.Pages {
fmt.Printf("Total pages: %v, Current page: %v\n", start_pagination.Pages, current_page)
page := start_pagination
page.Offset = current_page * page.Limit
tasks <- page

View file

@ -240,7 +240,6 @@ func workUnitDispatcher[T, S any](
config.TasksProcessed.Add(1)
case <-ctx.Done():
fmt.Println("context done")
return
}
}