コンテンツにスキップ
#0823
Exec

Reach into the running worker and change a variable

The vendor rotated their API host at 4pm. Your worker script holds it in a variable. A redeploy costs a minute you'd rather not spend; a restart empties the cache you spent all morning warming.

You don't redeploy. You POST to /api/v1/exec/shared-state/set with the hostname, a path of config.vendorHost, and the new value. The running VM's shared object changes in place. The next request reads the new host. The cache stays warm, the sockets stay open, nothing restarted. Add merge: true to patch a nested object instead of replacing it. shared-state/get with the same path shows you what the worker currently believes.

Config was something you shipped, then waited for. The worker's memory has an address, and you can write to it.

The worker's memory has an address, and you can write to it.