Skip to content

Commit df94f54

Browse files
committed
Dial to 20%
1 parent 045c0db commit df94f54

File tree

3 files changed

+3
-39
lines changed

3 files changed

+3
-39
lines changed

api/db/migration-state-queries.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -140,7 +140,7 @@ const forceStatelyMembershipIds = new Set([
140140
1234,
141141
]);
142142

143-
const dialPercentage = 0.1; // 0 - 1.0
143+
const dialPercentage = 0.2; // 0 - 1.0
144144

145145
// This would be better as a uniform hash but this is good enough for now
146146
function isUserDialedIn(bungieMembershipId: number) {

api/routes/import.ts

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ import { importHashTags } from '../stately/item-hash-tags-queries.js';
3030
import { importLoadouts } from '../stately/loadouts-queries.js';
3131
import { importSearches } from '../stately/searches-queries.js';
3232
import { convertToStatelyItem } from '../stately/settings-queries.js';
33-
import { batches, findNegativeNumbers } from '../stately/stately-utils.js';
33+
import { batches } from '../stately/stately-utils.js';
3434
import { importTriumphs } from '../stately/triumphs-queries.js';
3535
import { badRequest, subtractObject } from '../utils.js';
3636
import { deleteAllData } from './delete-all-data.js';
@@ -264,13 +264,7 @@ export async function statelyImport(
264264

265265
// OK now put them in as fast as we can
266266
for (const batch of batches(items)) {
267-
try {
268-
await client.putBatch(...batch);
269-
} catch (e) {
270-
findNegativeNumbers(batch);
271-
console.error('Stately error importing batch', e, batch);
272-
throw e;
273-
}
267+
await client.putBatch(...batch);
274268
}
275269

276270
return numTriumphs;

api/stately/stately-utils.ts

Lines changed: 0 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -138,33 +138,3 @@ export function* batches<T>(input: T[]): Generator<T[]> {
138138
yield input.slice(i * STATELY_MAX_BATCH_SIZE, (i + 1) * STATELY_MAX_BATCH_SIZE);
139139
}
140140
}
141-
142-
export function findNegativeNumbers(batch: any[]) {
143-
for (const item of batch) {
144-
try {
145-
recursiveNegative(item);
146-
} catch (e) {
147-
console.error(e);
148-
}
149-
}
150-
}
151-
152-
function recursiveNegative<T>(value: T): void {
153-
if (typeof value === 'number') {
154-
if (value === -1) {
155-
throw new Error(value.toString());
156-
}
157-
} else if (Array.isArray(value)) {
158-
return value.forEach(recursiveNegative);
159-
} else if (typeof value === 'object') {
160-
for (const [key, val] of Object.entries(value as Record<string, unknown>)) {
161-
try {
162-
recursiveNegative(val);
163-
} catch (e) {
164-
if (e instanceof Error) {
165-
throw new Error(`${key}: ${e.message}`);
166-
}
167-
}
168-
}
169-
}
170-
}

0 commit comments

Comments
 (0)