Skip to content

Commit

Permalink
fix: temorary hack
Browse files Browse the repository at this point in the history
  • Loading branch information
Yohe-Am committed Jul 24, 2024
1 parent 03bfe44 commit cdcb130
Show file tree
Hide file tree
Showing 9 changed files with 34 additions and 11 deletions.
6 changes: 3 additions & 3 deletions dev/consts.ts
Original file line number Diff line number Diff line change
Expand Up @@ -84,13 +84,13 @@ export const sedLockLines: Record<string, [string | RegExp, string][]> = {
[/(wasmtime = "\^).+(")/, WASMTIME_PY_VERSION],
],
"examples/templates/**/compose.yml": [
["( image: ghcr.io/metatypedev/typegate:v).+()", PUBLISHED_VERSION],
["( image: ghcr.io/metatypedev/typegate:v).+()", METATYPE_VERSION],
],
"examples/templates/**/pyproject.toml": [
['(typegraph = ").+(")', PUBLISHED_VERSION],
['(typegraph = ").+(")', METATYPE_VERSION],
],
"examples/templates/**/package.json": [
[/(\s*"@typegraph\/sdk"\s*:\s*"\^).+(",?)/, PUBLISHED_VERSION],
[/(\s*"@typegraph\/sdk"\s*:\s*"\^).+(",?)/, METATYPE_VERSION],
],
"examples/**/*.ts": [
[
Expand Down
2 changes: 1 addition & 1 deletion examples/templates/deno/compose.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
services:
typegate:
image: ghcr.io/metatypedev/typegate:v0.4.5
image: ghcr.io/metatypedev/typegate:v0.4.6-0
restart: always
ports:
- "7890:7890"
Expand Down
2 changes: 1 addition & 1 deletion examples/templates/node/compose.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
services:
typegate:
image: ghcr.io/metatypedev/typegate:v0.4.5
image: ghcr.io/metatypedev/typegate:v0.4.6-0
restart: always
ports:
- "7890:7890"
Expand Down
2 changes: 1 addition & 1 deletion examples/templates/node/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
"dev": "MCLI_LOADER_CMD='npm x tsx' meta dev"
},
"dependencies": {
"@typegraph/sdk": "^0.4.5"
"@typegraph/sdk": "^0.4.6-0"
},
"devDependencies": {
"tsx": "^3.13.0",
Expand Down
2 changes: 1 addition & 1 deletion examples/templates/python/compose.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
services:
typegate:
image: ghcr.io/metatypedev/typegate:v0.4.5
image: ghcr.io/metatypedev/typegate:v0.4.6-0
restart: always
ports:
- "7890:7890"
Expand Down
2 changes: 1 addition & 1 deletion examples/templates/python/pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ authors = []

[tool.poetry.dependencies]
python = ">=3.8,<4.0"
typegraph = "0.4.5"
typegraph = "0.4.6-0"

[build-system]
requires = ["poetry-core"]
Expand Down
4 changes: 2 additions & 2 deletions meta-cli/src/deploy/actors/discovery.rs
Original file line number Diff line number Diff line change
Expand Up @@ -75,15 +75,15 @@ impl<A: TaskAction + 'static> Actor for DiscoveryActor<A> {
Ok(_) => (),
Err(err) => console.error(format!("Error while discovering modules: {}", err)),
}

task_manager.do_send(task_manager::message::DiscoveryDone);
discovery.do_send(Stop);
}
.in_current_span();
ctx.spawn(fut.into_actor(self));
}

fn stopped(&mut self, _ctx: &mut Self::Context) {
log::trace!("DiscoveryActor stopped");
trace!("DiscoveryActor stopped");
}
}

Expand Down
24 changes: 24 additions & 0 deletions meta-cli/src/deploy/actors/task_manager.rs
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,10 @@ pub mod message {
#[derive(Message)]
#[rtype(result = "()")]
pub struct Restart;

#[derive(Message)]
#[rtype(result = "()")]
pub struct DiscoveryDone;
}

use message::*;
Expand Down Expand Up @@ -438,6 +442,26 @@ impl<A: TaskAction + 'static> Handler<TaskFinished<A>> for TaskManager<A> {
}
}

impl<A: TaskAction + 'static> Handler<DiscoveryDone> for TaskManager<A> {
type Result = ();

fn handle(&mut self, _: DiscoveryDone, ctx: &mut Context<Self>) -> Self::Result {
self.console.debug("discovery done".to_string());

// TODO check queue??
if self.active_tasks.is_empty() {
if self.watcher_addr.is_none() && self.pending_retries.is_empty() {
// no watcher, auto stop when all tasks finished
self.console.debug("all tasks finished".to_string());
self.stop_reason = Some(StopReason::Natural);
ctx.stop();
} else if let Some(StopReason::Manual) = self.stop_reason {
ctx.stop();
}
}
}
}

impl<A: TaskAction + 'static> Handler<Stop> for TaskManager<A> {
type Result = ();

Expand Down
1 change: 0 additions & 1 deletion typegate/tests/e2e/published/published_test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -204,7 +204,6 @@ Meta.test(
await examplesDir.join("deno.json").writeJson({});
await $.raw`bash -c 'deno add @typegraph/sdk@${previousVersion}'`
.cwd(examplesDir)
.env("NPM_CONFIG_REGISTRY", "https://registry.npmjs.org")
.stdout("inherit")
.printCommand();
},
Expand Down

0 comments on commit cdcb130

Please sign in to comment.