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

apps inherit app_name even when new name is specified #55

Open
shoup-healthtap opened this issue Mar 29, 2017 · 1 comment
Open

apps inherit app_name even when new name is specified #55

shoup-healthtap opened this issue Mar 29, 2017 · 1 comment

Comments

@shoup-healthtap
Copy link

shoup-healthtap commented Mar 29, 2017

I'm trying to run multiple groups of daemons, each group with a different name. The daemons run correctly, but they inherit their name from the first group to run even when I explicitly specify a new name.

example code:

options1 = {
  multiple: true,
  app_name: task1
}
options2 = {
  multiple: true,
  app_name: task2
}
2.times do Daemons.call(options1) { doTask1() } end
2.times do Daemons.call(options2) { doTask2() } end

The above code correctly spawns the four tasks but incorrectly refers to all four by the name task1.

Looking at the source code, I believe the issue is here in Application.new where new applications inherit the name of their group.

Is there a better way to use Daemons such these tasks are created within different groups? (Is this intended behavior?) Or is this a bug?

@thuehlinger
Copy link
Owner

thuehlinger commented Apr 2, 2017

Yes, this is the intended behaviour, since the simple #call interface assumes that you only want one application group.
I suggest to create different ApplicationGroups yourself and use these to create your applications. Like so:

options[:proc] = myproc1
group1 = ApplicationGroup.new(app_name, options)
group1.new_application(options)

options[:proc] = myproc
group2 = ApplicationGroup.new(app_name, options)
group2.new_application(options)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants