-
Notifications
You must be signed in to change notification settings - Fork 3.3k
internal: rework studio handshake to allow better caching #31599
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
Merged
Merged
Changes from all commits
Commits
Show all changes
62 commits
Select commit
Hold shift + click to select a range
5c96c83
feat: (studio) Capture telemetry for studio initialization
astone123 585d6cb
Merge branch 'develop' into 10501-studio-telemetry
astone123 27268ae
fixes
astone123 bd0ffdb
revert type changes
astone123 e22d26d
Merge branch 'develop' into 10501-studio-telemetry
astone123 1e84877
add studio lifecycle manager
astone123 9cb761c
fix studio router
ryanthemanuel 5189107
finish lifecycle manager, add test coverage
astone123 eb0e1cc
Merge branch 'develop' into 10501-studio-telemetry
astone123 62d7ef2
fix types
astone123 35bf761
fix types for real
astone123 61d3a5f
fix types actually
astone123 9f36293
fix lint
astone123 ab0dfa6
fix routes spec
astone123 3bda77e
Merge branch 'develop' into 10501-studio-telemetry
astone123 3e5796b
fix lint, add try/catch
astone123 b263416
Merge branch 'develop' into 10501-studio-telemetry
astone123 90e3fda
remove work to capture telemetry
astone123 75f68a4
didn't mean to remove this part
astone123 e24e862
fix types
astone123 a5593fe
remove test for other branch
astone123 b6e122c
feedback
astone123 a05b0d0
Merge branch 'develop' into 10501-studio-telemetry
astone123 8e9c883
fix test
astone123 4b2586f
encapsulate more logic into studio lifecycle manager
astone123 c6e15d7
Merge branch 'develop' into 10501-studio-telemetry
astone123 cb32e09
feedback
astone123 8db857a
Merge branch 'develop' into 10501-studio-telemetry
astone123 b24dbb9
merge develop
ryanthemanuel 5a581b8
fix tests
ryanthemanuel c8d92a2
blank
ryanthemanuel 3eb84ff
feedback
astone123 30c07b6
Update packages/app/src/runner/event-manager.ts
astone123 04eaa28
Merge branch 'develop' into 10501-studio-telemetry
astone123 030e929
fix lint
astone123 c9d7afb
fix hiding runner ui
ryanthemanuel ae7bb80
update test
astone123 cd21cbd
re-work lifecycle manager implementation to not use EventEmitter
astone123 c3073f3
Merge branch 'develop' into 10501-studio-telemetry
astone123 d79518c
fix listener registration logic
astone123 5d54e11
ensure that studio still loads even when cloud bundle doesn't
astone123 eaf6b4e
feedback
astone123 3b678de
feedback
astone123 327e4e3
Merge branch 'develop' into 10501-studio-telemetry
astone123 33fd989
Merge branch 'develop' into 10501-studio-telemetry
astone123 fc3cf5a
use getter for isProtocolEnabled, report studio manager initializatio…
astone123 c8c3e42
clean up listeners when initialization errors
astone123 efd8e59
Update packages/server/lib/StudioLifecycleManager.ts
astone123 e3f8aaa
Update packages/server/lib/StudioLifecycleManager.ts
astone123 303bd8d
Update packages/server/lib/StudioLifecycleManager.ts
astone123 2bc7221
feedback
astone123 6b66ce1
Merge branch 'develop' into 10501-studio-telemetry
astone123 34e24aa
fix: rework studio handshake to allow better caching
ryanthemanuel 0365f88
Merge branch '10501-studio-telemetry' into ryanm/fix/make-caching-pos…
ryanthemanuel 0d759ea
merge conflict
ryanthemanuel effb16f
Merge branch 'develop' into ryanm/fix/make-caching-possible
ryanthemanuel 7b39c1d
slight refactor
ryanthemanuel ca6aa3d
update types
ryanthemanuel b2aef6f
Update packages/server/lib/cloud/api/studio/post_studio_session.ts
ryanthemanuel 49fc556
Apply suggestions from code review
ryanthemanuel b14a214
fix test
ryanthemanuel 4e326ff
PR comment
ryanthemanuel File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
42 changes: 42 additions & 0 deletions
42
packages/server/lib/cloud/api/studio/post_studio_session.ts
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
import { asyncRetry, linearDelay } from '../../../util/async_retry' | ||
import { isRetryableError } from '../../network/is_retryable_error' | ||
import fetch from 'cross-fetch' | ||
import os from 'os' | ||
|
||
const pkg = require('@packages/root') | ||
const routes = require('../../routes') as typeof import('../../routes') | ||
|
||
interface GetStudioSessionOptions { | ||
projectId?: string | ||
} | ||
|
||
const _delay = linearDelay(500) | ||
|
||
export const postStudioSession = async ({ projectId }: GetStudioSessionOptions) => { | ||
return await (asyncRetry(async () => { | ||
const response = await fetch(routes.apiRoutes.studioSession(), { | ||
method: 'POST', | ||
headers: { | ||
'Content-Type': 'application/json', | ||
'x-os-name': os.platform(), | ||
'x-cypress-version': pkg.version, | ||
}, | ||
body: JSON.stringify({ projectSlug: projectId, studioMountVersion: 1, protocolMountVersion: 2 }), | ||
}) | ||
|
||
if (!response.ok) { | ||
throw new Error('Failed to create studio session') | ||
} | ||
|
||
const data = await response.json() | ||
|
||
return { | ||
studioUrl: data.studioUrl, | ||
protocolUrl: data.protocolUrl, | ||
} | ||
}, { | ||
maxAttempts: 3, | ||
retryDelay: _delay, | ||
shouldRetry: isRetryableError, | ||
}))() | ||
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.