@junctionpanel/server 0.1.70 → 0.1.72
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/server/client/daemon-client.d.ts +4 -0
- package/dist/server/client/daemon-client.d.ts.map +1 -1
- package/dist/server/client/daemon-client.js +69 -15
- package/dist/server/client/daemon-client.js.map +1 -1
- package/dist/server/server/session.d.ts +1 -0
- package/dist/server/server/session.d.ts.map +1 -1
- package/dist/server/server/session.js +48 -28
- package/dist/server/server/session.js.map +1 -1
- package/dist/server/utils/checkout-git.d.ts.map +1 -1
- package/dist/server/utils/checkout-git.js +154 -133
- package/dist/server/utils/checkout-git.js.map +1 -1
- package/package.json +2 -2
|
@@ -58,7 +58,7 @@ const WORKSPACE_STATUS_WATCH_DEBOUNCE_MS = 250;
|
|
|
58
58
|
const WORKSPACE_STATUS_GIT_REFRESH_MS = 3000;
|
|
59
59
|
const WORKSPACE_STATUS_PR_ACTIVE_REFRESH_MS = 15000;
|
|
60
60
|
const WORKSPACE_STATUS_PR_PASSIVE_REFRESH_MS = 60000;
|
|
61
|
-
const WORKSPACE_STATUS_PR_ACTIVE_CACHE_MAX_AGE_MS =
|
|
61
|
+
const WORKSPACE_STATUS_PR_ACTIVE_CACHE_MAX_AGE_MS = 45000;
|
|
62
62
|
const WORKSPACE_STATUS_PR_PASSIVE_CACHE_MAX_AGE_MS = 3 * 60000;
|
|
63
63
|
const PROVIDER_CHILD_THREADS_REFRESH_DEBOUNCE_MS = 250;
|
|
64
64
|
const PROVIDER_CHILD_THREADS_PERSISTED_LIST_INITIAL_LIMIT = 500;
|
|
@@ -3701,7 +3701,7 @@ export class Session {
|
|
|
3701
3701
|
clearInterval(target.prRefreshInterval);
|
|
3702
3702
|
target.prRefreshInterval = null;
|
|
3703
3703
|
}
|
|
3704
|
-
if (target
|
|
3704
|
+
if (!this.workspaceStatusShouldPollPullRequest(target)) {
|
|
3705
3705
|
return;
|
|
3706
3706
|
}
|
|
3707
3707
|
const intervalMs = this.resolveWorkspaceStatusPrRefreshIntervalMs(target);
|
|
@@ -3733,6 +3733,22 @@ export class Session {
|
|
|
3733
3733
|
? WORKSPACE_STATUS_PR_ACTIVE_REFRESH_MS
|
|
3734
3734
|
: WORKSPACE_STATUS_PR_PASSIVE_REFRESH_MS;
|
|
3735
3735
|
}
|
|
3736
|
+
workspaceStatusShouldPollPullRequest(target) {
|
|
3737
|
+
if (target.subscriptions.size === 0) {
|
|
3738
|
+
return false;
|
|
3739
|
+
}
|
|
3740
|
+
if (this.workspaceStatusHasActiveSubscribers(target)) {
|
|
3741
|
+
return true;
|
|
3742
|
+
}
|
|
3743
|
+
const latestPayload = target.latestPayload;
|
|
3744
|
+
if (!latestPayload
|
|
3745
|
+
|| !latestPayload.git.isGit
|
|
3746
|
+
|| latestPayload.pullRequestError
|
|
3747
|
+
|| !latestPayload.githubFeaturesEnabled) {
|
|
3748
|
+
return false;
|
|
3749
|
+
}
|
|
3750
|
+
return latestPayload.pullRequest != null && !latestPayload.pullRequest.isMerged;
|
|
3751
|
+
}
|
|
3736
3752
|
removeWorkspaceStatusSubscription(subscriptionId) {
|
|
3737
3753
|
const subscription = this.workspaceStatusSubscriptions.get(subscriptionId);
|
|
3738
3754
|
if (!subscription) {
|
|
@@ -3758,21 +3774,22 @@ export class Session {
|
|
|
3758
3774
|
if (includePr && options?.bumpPrGeneration) {
|
|
3759
3775
|
target.prRefreshGeneration += 1;
|
|
3760
3776
|
}
|
|
3777
|
+
if (includePr) {
|
|
3778
|
+
target.pendingPrRefresh = true;
|
|
3779
|
+
}
|
|
3780
|
+
else {
|
|
3781
|
+
target.pendingGitRefresh = true;
|
|
3782
|
+
}
|
|
3761
3783
|
if (!shouldDebounce) {
|
|
3762
|
-
void this.refreshWorkspaceStatusTarget(target
|
|
3784
|
+
void this.refreshWorkspaceStatusTarget(target);
|
|
3763
3785
|
return;
|
|
3764
3786
|
}
|
|
3765
3787
|
if (target.debounceTimer) {
|
|
3766
3788
|
clearTimeout(target.debounceTimer);
|
|
3767
3789
|
}
|
|
3768
|
-
if (includePr) {
|
|
3769
|
-
target.refreshIncludesPr = true;
|
|
3770
|
-
}
|
|
3771
3790
|
target.debounceTimer = setTimeout(() => {
|
|
3772
3791
|
target.debounceTimer = null;
|
|
3773
|
-
void this.refreshWorkspaceStatusTarget(target
|
|
3774
|
-
includePr: includePr || target.refreshIncludesPr,
|
|
3775
|
-
});
|
|
3792
|
+
void this.refreshWorkspaceStatusTarget(target);
|
|
3776
3793
|
}, WORKSPACE_STATUS_WATCH_DEBOUNCE_MS);
|
|
3777
3794
|
}
|
|
3778
3795
|
workspaceStatusSnapshotFingerprint(snapshot) {
|
|
@@ -3838,21 +3855,27 @@ export class Session {
|
|
|
3838
3855
|
};
|
|
3839
3856
|
}
|
|
3840
3857
|
async refreshWorkspaceStatusTarget(target, options) {
|
|
3858
|
+
if (options) {
|
|
3859
|
+
if (options.includePr) {
|
|
3860
|
+
target.pendingPrRefresh = true;
|
|
3861
|
+
}
|
|
3862
|
+
else {
|
|
3863
|
+
target.pendingGitRefresh = true;
|
|
3864
|
+
}
|
|
3865
|
+
}
|
|
3841
3866
|
if (target.refreshPromise) {
|
|
3842
|
-
target.refreshQueued = true;
|
|
3843
|
-
target.refreshIncludesPr = target.refreshIncludesPr || Boolean(options?.includePr);
|
|
3844
3867
|
return;
|
|
3845
3868
|
}
|
|
3846
3869
|
target.refreshPromise = (async () => {
|
|
3847
3870
|
do {
|
|
3848
|
-
const hasExplicitIncludePr = options != null && 'includePr' in options;
|
|
3849
3871
|
const fullGit = this.workspaceStatusHasActiveSubscribers(target);
|
|
3850
3872
|
const previousHasLoadedPullRequest = target.hasLoadedPullRequest;
|
|
3851
|
-
const
|
|
3852
|
-
|
|
3873
|
+
const hadPreviousPayload = target.latestPayload != null;
|
|
3874
|
+
const pendingGitRefresh = target.pendingGitRefresh;
|
|
3875
|
+
const includePr = target.pendingPrRefresh || (!hadPreviousPayload && !pendingGitRefresh);
|
|
3853
3876
|
const prRefreshGeneration = includePr ? target.prRefreshGeneration : null;
|
|
3854
|
-
target.
|
|
3855
|
-
target.
|
|
3877
|
+
target.pendingGitRefresh = false;
|
|
3878
|
+
target.pendingPrRefresh = false;
|
|
3856
3879
|
const snapshot = await this.computeWorkspaceStatusSnapshot(target, {
|
|
3857
3880
|
includePr,
|
|
3858
3881
|
fullGit,
|
|
@@ -3862,22 +3885,17 @@ export class Session {
|
|
|
3862
3885
|
}
|
|
3863
3886
|
const newerPrRefreshQueued = includePr
|
|
3864
3887
|
&& (prRefreshGeneration !== target.prRefreshGeneration
|
|
3865
|
-
|| target.
|
|
3866
|
-
|| target.refreshIncludesPr);
|
|
3888
|
+
|| target.pendingPrRefresh);
|
|
3867
3889
|
if (newerPrRefreshQueued) {
|
|
3868
|
-
target.refreshQueued = true;
|
|
3869
|
-
target.refreshIncludesPr = true;
|
|
3870
3890
|
continue;
|
|
3871
3891
|
}
|
|
3872
3892
|
const activeSubscribersPresent = this.workspaceStatusHasActiveSubscribers(target);
|
|
3873
3893
|
const gitIdentityChanged = this.workspaceStatusGitIdentityChanged(target.latestPayload, snapshot.git);
|
|
3874
|
-
const needsPrReplay =
|
|
3875
|
-
|| (!includePr && fullGit && activeSubscribersPresent && gitIdentityChanged);
|
|
3894
|
+
const needsPrReplay = !includePr && hadPreviousPayload && gitIdentityChanged && snapshot.git.isGit;
|
|
3876
3895
|
const needsFullGitReplay = !fullGit && activeSubscribersPresent;
|
|
3877
3896
|
if (needsPrReplay
|
|
3878
3897
|
|| needsFullGitReplay) {
|
|
3879
|
-
target.
|
|
3880
|
-
target.refreshIncludesPr = target.refreshIncludesPr || needsPrReplay || needsFullGitReplay;
|
|
3898
|
+
target.pendingPrRefresh = true;
|
|
3881
3899
|
continue;
|
|
3882
3900
|
}
|
|
3883
3901
|
target.latestPayload = snapshot;
|
|
@@ -3886,12 +3904,13 @@ export class Session {
|
|
|
3886
3904
|
|| includePr
|
|
3887
3905
|
|| (previousHasLoadedPullRequest && !gitIdentityChanged);
|
|
3888
3906
|
target.latestPayloadHasFullGitData = !snapshot.git.isGit || fullGit;
|
|
3907
|
+
this.updateWorkspaceStatusPrPolling(target);
|
|
3889
3908
|
const fingerprint = this.workspaceStatusSnapshotFingerprint(snapshot);
|
|
3890
3909
|
if (fingerprint !== target.latestFingerprint) {
|
|
3891
3910
|
target.latestFingerprint = fingerprint;
|
|
3892
3911
|
this.emitWorkspaceStatusChanged(target, snapshot);
|
|
3893
3912
|
}
|
|
3894
|
-
} while (target.
|
|
3913
|
+
} while (target.pendingGitRefresh || target.pendingPrRefresh);
|
|
3895
3914
|
})();
|
|
3896
3915
|
try {
|
|
3897
3916
|
await target.refreshPromise;
|
|
@@ -3919,8 +3938,8 @@ export class Session {
|
|
|
3919
3938
|
prRefreshInterval: null,
|
|
3920
3939
|
debounceTimer: null,
|
|
3921
3940
|
refreshPromise: null,
|
|
3922
|
-
|
|
3923
|
-
|
|
3941
|
+
pendingGitRefresh: false,
|
|
3942
|
+
pendingPrRefresh: false,
|
|
3924
3943
|
prRefreshGeneration: 0,
|
|
3925
3944
|
latestPayload: null,
|
|
3926
3945
|
latestFingerprint: null,
|
|
@@ -3978,7 +3997,7 @@ export class Session {
|
|
|
3978
3997
|
this.updateWorkspaceStatusGitPolling(target);
|
|
3979
3998
|
this.updateWorkspaceStatusPrPolling(target);
|
|
3980
3999
|
const fullGit = this.workspaceStatusHasActiveSubscribers(target);
|
|
3981
|
-
const includePr = fullGit;
|
|
4000
|
+
const includePr = fullGit || !target.latestPayload;
|
|
3982
4001
|
const previousFingerprint = target.latestFingerprint;
|
|
3983
4002
|
const hadExistingSubscribers = target.subscriptions.size > 1;
|
|
3984
4003
|
const snapshot = target.latestPayload
|
|
@@ -3991,6 +4010,7 @@ export class Session {
|
|
|
3991
4010
|
target.latestPayload = snapshot;
|
|
3992
4011
|
target.hasLoadedPullRequest = hasLoadedPullRequest;
|
|
3993
4012
|
target.latestPayloadHasFullGitData = !snapshot.git.isGit || fullGit;
|
|
4013
|
+
this.updateWorkspaceStatusPrPolling(target);
|
|
3994
4014
|
const nextFingerprint = this.workspaceStatusSnapshotFingerprint(snapshot);
|
|
3995
4015
|
target.latestFingerprint = nextFingerprint;
|
|
3996
4016
|
this.emit({
|