mirror of
https://github.com/clusterio/clusterio.git
synced 2026-11-22 00:13:12 +09:00
Add stopping instance status
Notify when an instance is in the process of stopping with a separate status for it. This makes handling shutdown gracefully a bit simpler in plugin code.
This commit is contained in:
1 parent
f6ab825692
commit
d3ea85d5ac
3 files changed
+7
-4
No files matched your search
@@ -368,7 +368,8 @@ messages.listInstances = new Request({
|
|||||||
"id": { type: "integer" },
|
"id": { type: "integer" },
|
||||||
"assigned_slave": { type: ["null", "integer"] },
|
"assigned_slave": { type: ["null", "integer"] },
|
||||||
"status": { enum: [
|
"status": { enum: [
|
||||||
"unknown", "unassigned", "stopped", "starting", "running", "creating_save", "exporting_data",
|
"unknown", "unassigned", "stopped", "starting", "running", "stopping",
|
||||||
|
"creating_save", "exporting_data",
|
||||||
]},
|
]},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
@@ -747,7 +748,7 @@ messages.updateInstances = new Request({
|
|||||||
properties: {
|
properties: {
|
||||||
"serialized_config": { type: "object" },
|
"serialized_config": { type: "object" },
|
||||||
"status": { enum: [
|
"status": { enum: [
|
||||||
"stopped", "starting", "running", "creating_save", "exporting_data",
|
"stopped", "starting", "running", "stopping", "creating_save", "exporting_data",
|
||||||
]},
|
]},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
@@ -979,7 +980,7 @@ messages.instanceStatusChanged = new Event({
|
|||||||
eventProperties: {
|
eventProperties: {
|
||||||
"instance_id": { type: "integer" },
|
"instance_id": { type: "integer" },
|
||||||
"status": { enum: [
|
"status": { enum: [
|
||||||
"stopped", "starting", "running", "creating_save", "exporting_data",
|
"stopped", "starting", "running", "stopping", "creating_save", "exporting_data",
|
||||||
]},
|
]},
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -260,6 +260,7 @@ class BaseMasterPlugin {
|
|||||||
* slave.
|
* slave.
|
||||||
* - `starting`: Instance is in the process of starting up.
|
* - `starting`: Instance is in the process of starting up.
|
||||||
* - `running`: Instance startup completed and is now running.
|
* - `running`: Instance startup completed and is now running.
|
||||||
|
* - `stopping`: Instance is in the processing stopping.
|
||||||
* - `creating_save`: Instance is in the process of creating a save.
|
* - `creating_save`: Instance is in the process of creating a save.
|
||||||
* - `exporting_data`: Instance is in the process of exporting item
|
* - `exporting_data`: Instance is in the process of exporting item
|
||||||
* icons and locale data.
|
* icons and locale data.
|
||||||
|
|||||||
@@ -224,7 +224,7 @@ class Instance extends libLink.Link {
|
|||||||
/**
|
/**
|
||||||
* Current state of the instance
|
* Current state of the instance
|
||||||
*
|
*
|
||||||
* One of stopped, starting, running, creating_save and exporting_data
|
* One of stopped, starting, running, stopping, creating_save and exporting_data
|
||||||
*
|
*
|
||||||
* @returns {string} instance status.
|
* @returns {string} instance status.
|
||||||
*/
|
*/
|
||||||
@@ -623,6 +623,7 @@ class Instance extends libLink.Link {
|
|||||||
*/
|
*/
|
||||||
async stop() {
|
async stop() {
|
||||||
this._running = false;
|
this._running = false;
|
||||||
|
this.notifyStatus("stopping");
|
||||||
|
|
||||||
// XXX this needs more thought to it
|
// XXX this needs more thought to it
|
||||||
if (this.server._state === "running") {
|
if (this.server._state === "running") {
|
||||||
|
|||||||
Reference in new issue
Block a user