Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 20 additions & 0 deletions cli/src/services/server/observatory.services.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ export const toggleOpenIdMonitoring = async ({

switch (action) {
case 'start': {
await updateRateConfig({context});
await startOpenIdMonitoring({context});
return;
}
Expand All @@ -25,6 +26,25 @@ export const toggleOpenIdMonitoring = async ({
}
};

const updateRateConfig = async ({context}: {context: CliContext}) => {
const {agent} = context;

const {update_rate_config} = await getObservatoryActor({
agent,
canisterId: OBSERVATORY_CANISTER_ID
});

await update_rate_config(
{OpenIdCertificateRequests: null},
{
max_tokens: 300n, // allow up to 300 requests
time_per_token_ns: 200_000_000n // 0.2s per token -> 300/min
}
);

console.log('Rate config applied! ✅');
};

const startOpenIdMonitoring = async ({context}: {context: CliContext}) => {
const {agent} = context;

Expand Down