winglang / wing

A programming language for the cloud ☁️ A unified programming model, combining infrastructure and runtime code into one language ⚡
https://winglang.io
Other
4.76k stars 187 forks source link

Simulator state is not remembered #5798

Open Chriscbr opened 4 months ago

Chriscbr commented 4 months ago

I tried this:

I wrote an app that has some state (a bucket and counter):

bring cloud;

let b = new cloud.Bucket();
let c = new cloud.Counter();

new cloud.Function(inflight () => {
  b.put("file-{c.inc()}", "data");
});

Then I ran wing it in my terminal, and called the function a few times, which increased the counter and added files to the bucket.

I pressed ctrl + C in my terminal to stop the simulation.

Later, I ran wing it again to start the simulation again.

This happened:

The counter is back to 0 and the bucket is empty

I expected this:

The last state I had for the simulator was saved

Is there a workaround?

No response

Anything else?

No response

Wing Version

0.59.12

Node.js Version

20.11.0

Platform(s)

MacOS

Community Notes

Chriscbr commented 4 months ago

@skyrpex should the Wing Console call stop() on the simulator and wait for it to finish when the user presses Ctrl + C so that the simulation state is saved?

Chriscbr commented 4 months ago

This may fix the problem where containers seem to keep running after the Wing Console is stopped

skyrpex commented 3 months ago

@skyrpex should the Wing Console call stop() on the simulator and wait for it to finish when the user presses Ctrl + C so that the simulation state is saved?

Yeah, will check how the console is handling the interrupt signal...

github-actions[bot] commented 3 weeks ago

Hi,

This issue hasn't seen activity in 90 days. Therefore, we are marking this issue as stale for now. It will be closed after 7 days. Feel free to re-open this issue when there's an update or relevant information to be added. Thanks!