Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor(core): Move instanceType to InstanceSettings (no-changelog) #10640

Merged
merged 1 commit into from
Sep 16, 2024

Conversation

netroy
Copy link
Member

@netroy netroy commented Sep 2, 2024

Summary

Context

Review / Merge checklist

  • PR title and summary are descriptive

@n8n-assistant n8n-assistant bot added core Enhancement outside /nodes-base and /editor-ui n8n team Authored by the n8n team labels Sep 2, 2024
tomi
tomi previously approved these changes Sep 3, 2024
Copy link
Collaborator

@tomi tomi left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice, much clearer this way 💟 Would be nice have getters for the different instance types

@@ -66,6 +68,13 @@ export class InstanceSettings {
this.instanceRole = 'follower';
}

// TODO: read from process.env instead, and make it readonly
instanceType?: InstanceType;
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could we also have getters for the instanceType like we have for instanceRole? I.e. isMain(Instance), isWebhook(Instance) & isWorker(Instance). Would make the comparisons simpler

@@ -60,7 +60,7 @@ export abstract class AbstractServer {

readonly uniqueInstanceId: string;

constructor(instanceType: N8nInstanceType = 'main') {
constructor(instanceType: Exclude<InstanceType, 'worker'>) {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice 👍 Much better documented now

@@ -630,5 +630,3 @@ export abstract class SecretsProvider {
abstract hasSecret(name: string): boolean;
abstract getSecretNames(): string[];
}

export type N8nInstanceType = 'main' | 'webhook' | 'worker';
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🎉

Copy link
Contributor

github-actions bot commented Sep 3, 2024

⚠️ Some Cypress E2E specs are failing, please fix them before merging

Copy link
Collaborator

@tomi tomi left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good 🚀 I still feel having separate getters like isMainInstance etc would make the comparisons cleaner

Copy link

cypress bot commented Sep 16, 2024

n8n    Run #6883

Run Properties:  status check passed Passed #6883  •  git commit 1c5469155f: 🌳 🖥️ browsers:node18.12.0-chrome107 🤖 netroy 🗃️ e2e/*
Project n8n
Branch Review generic.instanceType
Run status status check passed Passed #6883
Run duration 04m 43s
Commit git commit 1c5469155f: 🌳 🖥️ browsers:node18.12.0-chrome107 🤖 netroy 🗃️ e2e/*
Committer कारतोफ्फेलस्क्रिप्ट™
View all properties for this run ↗︎

Test results
Tests that failed  Failures 0
Tests that were flaky  Flaky 0
Tests that did not run due to a developer annotating a test with .skip  Pending 0
Tests that did not run due to a failure in a mocha hook  Skipped 0
Tests that passed  Passing 429
View all changes introduced in this branch ↗︎

Copy link
Contributor

✅ All Cypress E2E specs passed

@netroy netroy merged commit 25c8a32 into master Sep 16, 2024
38 checks passed
@netroy netroy deleted the generic.instanceType branch September 16, 2024 11:37
@netroy
Copy link
Member Author

netroy commented Sep 16, 2024

separate getters like isMainInstance etc would make the comparisons cleaner

Agreed. We can do this in a separate PR 🙏🏽

MiloradFilipovic added a commit that referenced this pull request Sep 17, 2024
* master:
  refactor(core): Set up worker server (#10814)
  fix(Google Vertex Chat Model Node): Clean service account private key (#10770)
  test(core): Mock filesystem in tests (#10823)
  test(core): Fix license mock in worker test (#10824)
  ci: Ignore certain paths for e2e tests for PRs (no-changelog) (#10533)
  fix(editor): Render image binary-data using img tags (#10829)
  refactor(core): Move `instanceType` to `InstanceSettings` (no-changelog) (#10640)
  ci(benchmark): Always perform az login before teardown (#10827)
  fix: Prevent copying workflow when copying outside of canvas (#10813)
  fix: Fix telemetry causing console error (#10828)
  refactor: Remove unused disable directives from `nodes-base` (#10825)
  refactor(core): Remove unused disable directives from backend packages (#10826)
  chore: Upgrade to TypeScript 5.6 (#10822)
  fix(editor): Prevent clipboard XSS injection (#10805)
  refactor(core): Simplify createDeferredPromise, and add tests (no-changelog) (#10811)
  fix(HTTP Request Tool Node): Fix subsequent tool calls reusung the same options (#10808)
  fix(editor): Make expression edit modal read-only in executions view (#10806)
  refactor(core): Move push message types to a new shared package (no-changelog) (#10742)
  fix(editor): Make schema view search copy more clear (#10807)
@janober
Copy link
Member

janober commented Sep 18, 2024

Got released with n8n@1.60.0

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
core Enhancement outside /nodes-base and /editor-ui n8n team Authored by the n8n team Released
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants