Skip to content

Commit

Permalink
Merge pull request #22 from CopilotNext/feature/new-metric-schema
Browse files Browse the repository at this point in the history
Feature/new metric schema
  • Loading branch information
DevOps-zhuang authored Dec 25, 2024
2 parents f2156a0 + 3da47e2 commit 6f0ff00
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 2 deletions.
2 changes: 1 addition & 1 deletion .env
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# to set whether save the child team data or not, default is false
CHILD_TEAM_ENABLED=true
CHILD_TEAM_ENABLED=false
# to set whether save the tenant information automatically or not, default is false
TENANT_AUTO_SAVE=true
# the below parameters are only used for nodejs server, not vue app since the vue app is a client side app
Expand Down
File renamed without changes.
12 changes: 11 additions & 1 deletion src/server.ts
Original file line number Diff line number Diff line change
Expand Up @@ -543,6 +543,16 @@ const runJob = async () => {
// Get current time and log it.
console.log(`Usage Data saved successfully for tenant ${tenant.scopeName} at ${now}`);

//wait for 1 second before saving the metrics data
await new Promise(resolve => setTimeout(resolve, 1000));

const metricsService = await CopilotServiceFactory.createMetricsService(tenant);
await metricsService.saveMetrics();
// Get current time and log it.
console.log(`Metrics Data saved successfully for tenant ${tenant.scopeName} at ${now}`);

//wait for 1 second before saving the seat data
await new Promise(resolve => setTimeout(resolve, 1000));
// get the seat service for the tenant, and save the seat data
const seatService = await CopilotServiceFactory.createSeatService(tenant);
await seatService.saveSeatData();
Expand All @@ -560,7 +570,7 @@ const runJob = async () => {
};

// Run it once the server starts
//runJob();
runJob();

// Run job every 12 hours
setInterval(runJob, 12 * 60 * 60 * 1000);
Expand Down

0 comments on commit 6f0ff00

Please sign in to comment.