Skip to content
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

chore: diff-based simulator updates in Wing Console by default #6530

Merged
merged 2 commits into from
Jun 25, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 1 addition & 6 deletions apps/wing-console/console/server/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -60,10 +60,6 @@ export type RouteNames = keyof inferRouterInputs<Router> | undefined;

export { isTermsAccepted } from "./utils/terms-and-conditions.js";

const enableSimUpdates =
process.env.WING_ENABLE_INPLACE_UPDATES === "true" ||
process.env.WING_ENABLE_INPLACE_UPDATES === "1";

export interface CreateConsoleServerOptions {
wingfile: string;
log: LogInterface;
Expand Down Expand Up @@ -144,7 +140,6 @@ export const createConsoleServer = async ({

const simulator = createSimulator({
stateDir,
enableSimUpdates,
});
if (onTrace) {
simulator.on("trace", onTrace);
Expand All @@ -162,7 +157,7 @@ export const createConsoleServer = async ({
testing: true,
watchGlobs,
});
const testSimulator = createSimulator({ enableSimUpdates });
const testSimulator = createSimulator();
testCompiler.on("compiled", ({ simfile }) => {
testSimulator.start(simfile);
});
Expand Down
15 changes: 4 additions & 11 deletions apps/wing-console/console/server/src/utils/simulator.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@ export interface Simulator {

export interface CreateSimulatorProps {
stateDir?: string;
enableSimUpdates?: boolean;
}

const stopSilently = async (simulator: simulator.Simulator) => {
Expand All @@ -51,16 +50,10 @@ export const createSimulator = (props?: CreateSimulatorProps): Simulator => {
if (!instance) {
return true;
}
if (props?.enableSimUpdates) {
await events.emit("starting", { instance });
await instance.update(simfile);
await events.emit("started");
return false;
} else {
await events.emit("stopping");
await stopSilently(instance);
return true;
}
await events.emit("starting", { instance });
await instance.update(simfile);
await events.emit("started");
return false;
};
const start = async (simfile: string) => {
try {
Expand Down
Loading