12 lines
314 B
TypeScript
12 lines
314 B
TypeScript
export function getAdaptiveImageQueueOwnerLimit(params: {
|
|
maxConcurrent: number;
|
|
hasCompetingOwner: boolean;
|
|
}) {
|
|
const maxConcurrent = Math.max(1, Math.floor(params.maxConcurrent || 1));
|
|
if (!params.hasCompetingOwner) {
|
|
return maxConcurrent;
|
|
}
|
|
|
|
return Math.max(1, Math.ceil(maxConcurrent / 2));
|
|
}
|