Closed justmark closed 1 year ago
Is your ruby worker class written like
module V1
class StatisticsWorker
end
end
by chance?
If so you probably need your worker name to be V1::StatisticsWorker
.
You can also call perform_async
on the worker directly and override the worker name via the trait implementation: https://github.com/film42/sidekiq-rs#customizing-the-worker-name-for-workers-under-a-nested-ruby-module
mod v1 {
#[async_trait]
impl sidekiq::Worker<()> for StatisticsWorker {
// ...
fn class_name() -> String
where
Self: Sized,
{
"V1::StatisticsWorker".to_string()
}
// ...
}
}
And then calling from the helper methods on the worker trait:
v1::StatisticsWorker::opts().queue("v1_statistics".into()).perform_async(sidekiq, payload_data).await?;
Hi,
No, the Ruby classes themselves aren't in a module. Here's the same Ruby definition:
class V1StatisticsWorker
include Sidekiq::Worker
sidekiq_options queue: :v1_statistics
def perform(payload)
end
end
Mark
👍 Good to know. Let me see if I can reproduce with that ruby worker.
I can't seem to reproduce. Does that demo I opened a PR for work for you?
We’re all good with v0.6.1.
Thanks for this!
Hi,
Just updated to 0.6.0. All my current jobs have been created via our Ruby platform. Today I started some new workers being generated through sidekiq-rs. The jobs are showing up on the server, but the server is reporting an error and saving the jobs as retries.
Here is the code for creating the job via your crate-level method:
On my Sidekiq server, the job is showing up with the correct Job and Queue name, but the error showing up is:
NameError: uninitialized constant V1StatisticsWorker
- is this possibly an issue with the namespacing?If I generate the job from Ruby, no error shows up.