Skip to content

Commit 03e25eb

Browse files
authored
Adjusted location of the perf measurement for jql (#706)
* Adjusted location of the measurement end for jql refresh and initial fetching * Changed the area in where the calculate the initial load time of jql tree for issues in executeJqlQuery, allowing for an optional isInitialLoad boolean. * Finished up changes to perf tracking for jql fetching. * Reverted some changes to original * Another reverted change
1 parent 7c0bc13 commit 03e25eb

File tree

1 file changed

+9
-10
lines changed

1 file changed

+9
-10
lines changed

src/views/jira/treeViews/jiraAssignedWorkItemsViewProvider.ts

Lines changed: 9 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -26,9 +26,8 @@ import { SearchJiraHelper } from '../searchJiraHelper';
2626
import { executeJqlQuery, JiraIssueNode, loginToJiraMessageNode, TreeViewIssue } from './utils';
2727

2828
const AssignedWorkItemsViewProviderId = AssignedJiraItemsViewId;
29-
30-
const InitialCumulativeJqlFetchEventName = 'ui.jira.jqlFetch.render.lcp';
3129
const RefreshCumulativeJqlFetchEventName = 'ui.jira.jqlFetch.update.lcp';
30+
const InitialCumulativeJqlFetchEventName = 'ui.jira.jqlFetch.render.lcp';
3231

3332
export class AssignedWorkItemsViewProvider extends Disposable implements TreeDataProvider<TreeItem> {
3433
private static readonly _treeItemConfigureJiraMessage = loginToJiraMessageNode;
@@ -63,7 +62,14 @@ export class AssignedWorkItemsViewProvider extends Disposable implements TreeDat
6362
const jqlEntries = Container.jqlManager.getAllDefaultJQLEntries();
6463
if (jqlEntries.length) {
6564
timer.mark(InitialCumulativeJqlFetchEventName);
66-
this._initPromises = new PromiseRacer(jqlEntries.map(executeJqlQuery));
65+
const promises = jqlEntries.map(executeJqlQuery);
66+
this._initPromises = new PromiseRacer(promises);
67+
Promise.all(promises).then(() => {
68+
const jqlInitialDuration = timer.measureAndClear(InitialCumulativeJqlFetchEventName);
69+
performanceEvent(InitialCumulativeJqlFetchEventName, jqlInitialDuration).then((event) => {
70+
Container.analyticsClient.sendTrackEvent(event);
71+
});
72+
});
6773
}
6874

6975
Container.context.subscriptions.push(configuration.onDidChange(this.onConfigurationChanged, this));
@@ -134,7 +140,6 @@ export class AssignedWorkItemsViewProvider extends Disposable implements TreeDat
134140
// - append the data to `this._children` and resolve this promise returning it
135141
// - if there are still JQL promises in PromiseRacer, trigger another DidChangeTreeData immediately
136142
// which will stay pending until the next JQL promise with data resolves, or until all JQL promises are done
137-
138143
while (!this._initPromises.isEmpty()) {
139144
const issues = await this._initPromises.next();
140145
if (!issues.length) {
@@ -151,11 +156,6 @@ export class AssignedWorkItemsViewProvider extends Disposable implements TreeDat
151156
if (!this._initPromises.isEmpty()) {
152157
// need to trigger a DidChangeTreeData after this method ends - 10ms as a small-enough timeout
153158
setTimeout(() => this._onDidChangeTreeData.fire(), 10);
154-
} else {
155-
const jqlInitialDuration = timer.measureAndClear(InitialCumulativeJqlFetchEventName);
156-
performanceEvent(InitialCumulativeJqlFetchEventName, jqlInitialDuration).then((event) => {
157-
Container.analyticsClient.sendTrackEvent(event);
158-
});
159159
}
160160

161161
return this._initChildren;
@@ -167,7 +167,6 @@ export class AssignedWorkItemsViewProvider extends Disposable implements TreeDat
167167
if (!jqlEntries.length) {
168168
return [AssignedWorkItemsViewProvider._treeItemConfigureJiraMessage];
169169
}
170-
171170
const allIssues = (await Promise.all(jqlEntries.map(executeJqlQuery))).flat();
172171

173172
if (this._skipNotificationForNextFetch) {

0 commit comments

Comments
 (0)