Skip to content

Commit cbe8bc3

Browse files
committed
revert: restore getMemoryStats as a query call
Sampling keeps to_candid calls bounded to ~10,000 per structure, so query instruction limits are no longer a concern. Made-with: Cursor
1 parent 135a9fa commit cbe8bc3

4 files changed

Lines changed: 4 additions & 4 deletions

File tree

backend/main/main-canister.mo

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -644,7 +644,7 @@ actor class Main() = this {
644644
sum * total / sampled;
645645
};
646646

647-
public shared ({ caller }) func getMemoryStats() : async MemoryStats {
647+
public query ({ caller }) func getMemoryStats() : async MemoryStats {
648648
assert (Utils.isAdmin(caller));
649649

650650
let dlStats = downloadLog.getMemoryStats();

cli/declarations/main/main.did

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -347,7 +347,7 @@ type Main =
347347
SemverPart;
348348
}) -> (Result_6) query;
349349
getHighestVersion: (name: PackageName) -> (Result_5) query;
350-
getMemoryStats: () -> (MemoryStats);
350+
getMemoryStats: () -> (MemoryStats) query;
351351
getMostDownloadedPackages: () -> (vec PackageSummary) query;
352352
getMostDownloadedPackagesIn7Days: () -> (vec PackageSummary) query;
353353
getNewPackages: () -> (vec PackageSummary) query;

cli/declarations/main/main.did.d.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -111,7 +111,7 @@ export interface Main {
111111
Result_6
112112
>,
113113
'getHighestVersion' : ActorMethod<[PackageName], Result_5>,
114-
'getMemoryStats' : ActorMethod<[], MemoryStats>,
114+
'getMemoryStats' : ActorMethod<[], MemoryStats, 'query'>,
115115
'getMostDownloadedPackages' : ActorMethod<[], Array<PackageSummary>>,
116116
'getMostDownloadedPackagesIn7Days' : ActorMethod<[], Array<PackageSummary>>,
117117
'getNewPackages' : ActorMethod<[], Array<PackageSummary>>,

cli/declarations/main/main.did.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -342,7 +342,7 @@ export const idlFactory = ({ IDL }) => {
342342
['query'],
343343
),
344344
'getHighestVersion' : IDL.Func([PackageName], [Result_5], ['query']),
345-
'getMemoryStats' : IDL.Func([], [MemoryStats], []),
345+
'getMemoryStats' : IDL.Func([], [MemoryStats], ['query']),
346346
'getMostDownloadedPackages' : IDL.Func(
347347
[],
348348
[IDL.Vec(PackageSummary)],

0 commit comments

Comments
 (0)