misukisu commited on
Commit
3d3b8d2
·
verified ·
1 Parent(s): a769ce4

pregen retry, quiet chunky

Browse files
Files changed (1) hide show
  1. app.py +13 -7
app.py CHANGED
@@ -234,9 +234,9 @@ def tune(srv: Path):
234
  (plugins / "Chunky").mkdir(exist_ok=True)
235
  cfg = plugins / "Chunky" / "config.yml"
236
  if cfg.exists():
237
- yset(cfg, {"continue-on-restart": True})
238
  else:
239
- cfg.write_text("continue-on-restart: true\n")
240
 
241
 
242
  async def ensure_tuned(sid):
@@ -254,11 +254,17 @@ async def ensure_tuned(sid):
254
  break
255
  await asyncio.sleep(10)
256
  await asyncio.sleep(20)
257
- for c in ("chunky world world", "chunky center 0 0", f"chunky radius {PREGEN_RADIUS}", "chunky start"):
258
- await crafty.cmd(c)
259
- await asyncio.sleep(1)
260
- marker.write_text(PREGEN_RADIUS)
261
- log.info("pregen started r=%s", PREGEN_RADIUS)
 
 
 
 
 
 
262
 
263
 
264
  def make_archive(path: Path):
 
234
  (plugins / "Chunky").mkdir(exist_ok=True)
235
  cfg = plugins / "Chunky" / "config.yml"
236
  if cfg.exists():
237
+ yset(cfg, {"continue-on-restart": True, "silent": True})
238
  else:
239
+ cfg.write_text("continue-on-restart: true\nsilent: true\n")
240
 
241
 
242
  async def ensure_tuned(sid):
 
254
  break
255
  await asyncio.sleep(10)
256
  await asyncio.sleep(20)
257
+ for _ in range(10):
258
+ for c in ("chunky world world", "chunky center 0 0", f"chunky radius {PREGEN_RADIUS}", "chunky start"):
259
+ await crafty.cmd(c)
260
+ await asyncio.sleep(1)
261
+ await asyncio.sleep(15)
262
+ logs = (await crafty.req("GET", f"/api/v2/servers/{sid}/logs?raw=true")).get("data") or []
263
+ if any("Task started" in l or "already running" in l or "Task running" in l for l in logs[-50:]):
264
+ marker.write_text(PREGEN_RADIUS)
265
+ log.info("pregen started r=%s", PREGEN_RADIUS)
266
+ break
267
+ await asyncio.sleep(30)
268
 
269
 
270
  def make_archive(path: Path):