Skip to content

Commit 85c0d71

Browse files
committed
refactor(paged-request): remove unused, untested paged-request
BREAKING CHANGE: PagedRequest no longer exists
1 parent 048ea01 commit 85c0d71

File tree

8 files changed

+9
-195
lines changed

8 files changed

+9
-195
lines changed

src/dynamo/index.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
export * from './batchget'
22
export * from './expression'
3-
export * from './paged'
43
export * from './request'
54
export * from './dynamo-rx'
65
export * from './dynamo-store'

src/dynamo/paged/index.ts

Lines changed: 0 additions & 2 deletions
This file was deleted.

src/dynamo/paged/pageable.ts

Lines changed: 0 additions & 12 deletions
This file was deleted.

src/dynamo/paged/paged-data-source.ts

Lines changed: 0 additions & 161 deletions
This file was deleted.

src/dynamo/paged/paged-request-meta.ts

Lines changed: 0 additions & 5 deletions
This file was deleted.

src/dynamo/request/batchwritesingletable/batch-write-single-table.request.ts

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ export class BatchWriteSingleTableRequest<T> {
2020
}
2121
return this.keyFn
2222
}
23+
2324
private keyFn: any
2425

2526
readonly dynamoRx: DynamoRx
@@ -85,25 +86,23 @@ export class BatchWriteSingleTableRequest<T> {
8586
)
8687
}
8788

89+
// fixme backoff time is resetted for every request.. :/
8890
/**
8991
*
9092
* @param backoffTimer generator for how much timeSlots should be waited before requesting next batch. only used when capacity was exceeded. default randomExponentialBackoffTimer
9193
* @param throttleTimeSlot defines how long one timeSlot is for throttling, default 1 second
9294
*/
9395
exec(backoffTimer = randomExponentialBackoffTimer, throttleTimeSlot = 1000): Observable<void> {
9496
this.logger.debug('starting batchWriteItem')
95-
let rBoT = backoffTimer()
96-
let backoffTime = 0
97+
const rBoT = backoffTimer()
9798
return this.execNextBatch().pipe(
9899
mergeMap((r: BatchWriteSingleTableResponse) => {
99-
if (!r.capacityExceeded) {
100-
rBoT = backoffTimer()
101-
backoffTime = 0
102-
} else {
103-
backoffTime = rBoT.next().value * throttleTimeSlot
100+
if (r.capacityExceeded) {
101+
const backoffTime = rBoT.next().value * throttleTimeSlot
104102
this.logger.info(`wait ${backoffTime} ms until next request`, { backoffTime })
103+
return of(r).pipe(delay(backoffTime))
105104
}
106-
return of(r).pipe(delay(backoffTime))
105+
return of(r)
107106
}),
108107
mergeMap((r: BatchWriteSingleTableResponse) => {
109108
if (r.remainingItems > 0) {

src/dynamo/request/query/query.request.ts

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,12 +14,10 @@ import {
1414
RequestConditionFunction,
1515
RequestSortKeyConditionFunction,
1616
} from '../../expression/type'
17-
import { Pageable } from '../../paged'
1817
import { Request } from '../request.model'
1918
import { QueryResponse } from './query.response'
2019

21-
export class QueryRequest<T> extends Request<T, QueryRequest<T>, QueryInput, QueryResponse<T>>
22-
implements Pageable<T, QueryRequest<T>, QueryResponse<T>> {
20+
export class QueryRequest<T> extends Request<T, QueryRequest<T>, QueryInput, QueryResponse<T>> {
2321
private readonly logger: Logger
2422

2523
constructor(dynamoRx: DynamoRx, modelClazz: ModelConstructor<T>, tableName: string) {

src/dynamo/request/scan/scan.request.ts

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,12 +10,10 @@ import { and } from '../../expression'
1010
import { addExpression } from '../../expression/param-util'
1111
import { addCondition } from '../../expression/request-expression-builder'
1212
import { ConditionExpressionDefinitionFunction, RequestConditionFunction } from '../../expression/type'
13-
import { Pageable } from '../../paged'
1413
import { Request } from '../request.model'
1514
import { ScanResponse } from './scan.response'
1615

17-
export class ScanRequest<T> extends Request<T, ScanRequest<T>, ScanInput, ScanResponse<T>>
18-
implements Pageable<T, ScanRequest<T>, ScanResponse<T>> {
16+
export class ScanRequest<T> extends Request<T, ScanRequest<T>, ScanInput, ScanResponse<T>> {
1917
private readonly logger: Logger
2018

2119
constructor(dynamoRx: DynamoRx, modelClazz: ModelConstructor<T>, tableName: string) {

0 commit comments

Comments
 (0)