Fixed a few bugs
- Fixed a seg fault bug when cancelling a scan or query when no results are available yet - Reduce the size of each page to return so that progress indicators work
This commit is contained in:
parent
7eb4ea7222
commit
fc75070a4f
|
@ -277,6 +277,10 @@ func (c *TableReadController) handleResultSetFromJobResult(filter string, pushba
|
|||
|
||||
var partialResultsErr models.PartialResultsError
|
||||
if errors.As(err, &partialResultsErr) {
|
||||
if newResultSet == nil {
|
||||
return events.StatusMsg("Operation cancelled")
|
||||
}
|
||||
|
||||
return events.Confirm(applyToN("View the ", len(newResultSet.Items()), "item", "items", " returned so far? "), func(yes bool) tea.Msg {
|
||||
if yes {
|
||||
return c.setResultSetAndFilter(newResultSet, filter, pushbackStack, op)
|
||||
|
|
|
@ -115,7 +115,9 @@ func (p *Provider) ScanItems(ctx context.Context, tableName string, filterExpr *
|
|||
input.ExpressionAttributeValues = filterExpr.Values()
|
||||
}
|
||||
|
||||
paginator := dynamodb.NewScanPaginator(p.client, input)
|
||||
paginator := dynamodb.NewScanPaginator(p.client, input, func(opt *dynamodb.ScanPaginatorOptions) {
|
||||
opt.Limit = 100
|
||||
})
|
||||
|
||||
items := make([]models.Item, 0)
|
||||
|
||||
|
@ -136,13 +138,13 @@ outer:
|
|||
if len(items) >= maxItems {
|
||||
break outer
|
||||
}
|
||||
}
|
||||
|
||||
if time.Now().After(nextUpdate) {
|
||||
jobs.PostUpdate(ctx, fmt.Sprintf("found %d items", len(items)))
|
||||
nextUpdate = time.Now().Add(1 * time.Second)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return items, nil
|
||||
}
|
||||
|
@ -159,7 +161,9 @@ func (p *Provider) QueryItems(ctx context.Context, tableName string, filterExpr
|
|||
input.ExpressionAttributeValues = filterExpr.Values()
|
||||
}
|
||||
|
||||
paginator := dynamodb.NewQueryPaginator(p.client, input)
|
||||
paginator := dynamodb.NewQueryPaginator(p.client, input, func(opt *dynamodb.QueryPaginatorOptions) {
|
||||
opt.Limit = 100
|
||||
})
|
||||
|
||||
items := make([]models.Item, 0)
|
||||
|
||||
|
@ -180,13 +184,13 @@ outer:
|
|||
if len(items) >= maxItems {
|
||||
break outer
|
||||
}
|
||||
}
|
||||
|
||||
if time.Now().After(nextUpdate) {
|
||||
jobs.PostUpdate(ctx, fmt.Sprintf("found %d items", len(items)))
|
||||
nextUpdate = time.Now().Add(1 * time.Second)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return items, nil
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue