-
Notifications
You must be signed in to change notification settings - Fork 34
Bug 1723090 - Delete trailing glean.restarted events #1452
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
ec5eb20
1b3039d
77e8cdd
15fb3fc
432dd90
7c06436
9772c2e
a8f8ed4
b5fe0a1
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,28 @@ | ||
| /* This Source Code Form is subject to the terms of the Mozilla Public | ||
| * License, v. 2.0. If a copy of the MPL was not distributed with this | ||
| * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ | ||
|
|
||
| import { Context } from "../context.js"; | ||
| import EventsDatabase from "../metrics/events_database/index.js"; | ||
|
|
||
| /** | ||
| * Test-only API | ||
| * | ||
| * Fakes a restart by creating a new instance of the events database which will | ||
| * log a `glean.restarted` event. | ||
| * | ||
| * If you do not move the clock forward, an error will be logged. | ||
| * | ||
| * @param timeOffset How far ahead to move clock before restarting. Some events just need | ||
| * a future time, others need a specific future time. The default time is 1 minute. | ||
| * @returns New instance of `EventsDatabase` since we "restarted" it. | ||
| */ | ||
| export async function testRestartGlean(timeOffset: number = 1000 * 60): Promise<EventsDatabase> { | ||
| // Move the clock to look like Glean was really restarted. | ||
| Context.startTime.setTime(Context.startTime.getTime() + timeOffset); | ||
|
|
||
| // Fake a restart. | ||
| const db = new EventsDatabase(); | ||
| await db.initialize(); | ||
| return db; | ||
| } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -29,3 +29,6 @@ export async function testResetGlean( | |
| await testUninitializeGlean(clearStores); | ||
| await testInitializeGlean(applicationId, uploadEnabled, config); | ||
| } | ||
|
|
||
| export * from "./utils.js"; | ||
|
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Clarification for this A more common pattern in JS/TS is to bubble all of your folder/module exports up to an index.ts file, "barrel file", and export everything from there. That way when you are accessing different functions/variables/constants you only have to drill down to the top level of the folder when importing. So instead of pulling 3 things from index, 4 things from utils, etc, you re-export everything you need from the index then you can just import it all via import {} from '../core/testing. This also helps to keep things more organized and modular. You start to see very quickly what may be tightly coupled to a module that doesn't need to be. |
||
| export * from "./events.js"; | ||
Uh oh!
There was an error while loading. Please reload this page.