Skip to content
This repository has been archived by the owner on Apr 6, 2023. It is now read-only.

sidekiq:quiet fails on first deploy #25

Open
x-yuri opened this issue Oct 25, 2017 · 5 comments
Open

sidekiq:quiet fails on first deploy #25

x-yuri opened this issue Oct 25, 2017 · 5 comments

Comments

@x-yuri
Copy link
Contributor

x-yuri commented Oct 25, 2017

Since it assumes that current_path exists. Which doesn't on first deploy.

Workaround:

task 'smart:sidekiq:quiet' do
  command "
    if [ -e '#{fetch(:current_path)}' ]; then
      #{get_task_commands('sidekiq:quiet')}
    fi
  "
end

def get_task_commands(task)
  on(:get_task_commands_stage) do
    invoke task
  end
  commands.delete(:get_task_commands_stage).join(" &&\n")
end

Or a more elaborate version (that keeps the generated code nicely indented):

task 'sidekiq:quiet:smart' do
  command "
    if [ -e '#{fetch(:current_path)}' ]; then
      #{indent_but_first(
        6, get_task_commands('sidekiq:quiet')
      ).join(" &&\n")}
    fi
  "
end

def get_task_commands(task)
  on(:get_task_commands_stage) do
    invoke task
  end
  commands.delete(:get_task_commands_stage)
end

def indent_but_first(count, commands)
  commands.map.with_index { |s, i| i > 0 ? indent(count, s) : s }
end
@Mic92
Copy link
Owner

Mic92 commented Nov 5, 2017

is this also solved by: #27?

@x-yuri
Copy link
Contributor Author

x-yuri commented Nov 6, 2017

Certainly not.

@Mic92
Copy link
Owner

Mic92 commented Apr 17, 2020

See #32 (comment)

@x-yuri
Copy link
Contributor Author

x-yuri commented Apr 17, 2020

Fixed in #33? I can still see the assumption.

@Mic92
Copy link
Owner

Mic92 commented Apr 17, 2020

What I mean to say I am not going to fix it, but accept pull requests, since I am not using sidekiq, rails or mina since years.

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

No branches or pull requests

2 participants