-
Notifications
You must be signed in to change notification settings - Fork 39
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
Add Active Job annotations #191
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,82 @@ | ||
# typed: true | ||
|
||
class ActiveJob::Base | ||
sig { params(blk: T.proc.bind(T.attached_class).params(job: T.attached_class).void).void } | ||
def self.after_discard(&blk); end | ||
|
||
sig do | ||
params(filters: T.untyped, blk: T.nilable(T.proc.bind(T.attached_class).params(job: T.attached_class).void)).void | ||
end | ||
def self.after_enqueue(*filters, &blk); end | ||
|
||
sig do | ||
params(filters: T.untyped, blk: T.nilable(T.proc.bind(T.attached_class).params(job: T.attached_class).void)).void | ||
end | ||
def self.after_perform(*filters, &blk); end | ||
|
||
sig do | ||
params( | ||
filters: T.untyped, | ||
blk: T.nilable(T.proc.bind(T.attached_class).params(job: T.attached_class, block: T.untyped).void) | ||
).void | ||
end | ||
def self.around_enqueue(*filters, &blk); end | ||
|
||
sig do | ||
params( | ||
filters: T.untyped, | ||
blk: T.nilable(T.proc.bind(T.attached_class).params(job: T.attached_class, block: T.untyped).void) | ||
).void | ||
end | ||
def self.around_perform(*filters, &blk); end | ||
|
||
sig do | ||
params(filters: T.untyped, blk: T.nilable(T.proc.bind(T.attached_class).params(job: T.attached_class).void)).void | ||
end | ||
def self.before_enqueue(*filters, &blk); end | ||
|
||
sig do | ||
params(filters: T.untyped, blk: T.nilable(T.proc.bind(T.attached_class).params(job: T.attached_class).void)).void | ||
end | ||
def self.before_perform(*filters, &blk); end | ||
|
||
sig do | ||
type_parameters(:ExceptionType) | ||
.params( | ||
exceptions: T::Class[T.type_parameter(:ExceptionType)], | ||
block: T.nilable(T.proc.params(job: T.attached_class, error: T.type_parameter(:ExceptionType)).void) | ||
).void | ||
end | ||
sig do | ||
params(exceptions: String, block: T.nilable(T.proc.params(job: T.attached_class, error: T.untyped).void)).void | ||
end | ||
def self.discard_on(*exceptions, &block); end | ||
|
||
sig do | ||
params( | ||
klasses: T.any(Module, String), | ||
with: T.nilable(Symbol), | ||
block: T.nilable(T.proc.params(exception: T.untyped).void) | ||
).void | ||
end | ||
def self.rescue_from(*klasses, with: nil, &block); end | ||
|
||
sig do | ||
params( | ||
exceptions: T.any(Module, String), | ||
wait: T.any(ActiveSupport::Duration, Integer, Symbol, T.proc.params(executions: Integer).returns(Integer)), | ||
attempts: T.any(Integer, Symbol), | ||
queue: T.nilable(T.any(String, Symbol)), | ||
priority: T.untyped, | ||
jitter: Numeric, | ||
block: T.nilable(T.proc.params(job: T.attached_class, error: T.untyped).void) | ||
).void | ||
end | ||
def self.retry_on(*exceptions, wait: 3.seconds, attempts: 5, queue: nil, priority: nil, jitter: JITTER_DEFAULT, &block); end | ||
|
||
sig { params(part_name: T.nilable(T.any(String, Symbol)), block: T.nilable(T.proc.bind(T.attached_class).returns(T.untyped))).void } | ||
def self.queue_as(part_name = nil, &block); end | ||
|
||
sig { params(priority: T.untyped, block: T.nilable(T.proc.bind(T.attached_class).returns(T.untyped))).void } | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Isn't There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Honestly I had no idea, I've never used this feature TBH and I wasn't sure if this was backend-specific. Can make the change. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It seems there's not much documentation or examples for that, so let's keep it as |
||
def self.queue_with_priority(priority = nil, &block); end | ||
end |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🤔 I don't see
ActiveSupport::Duration
in the docs, even though the implementation indicates it should work.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
3.seconds
is the default value which is a duration? :)There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, and I now see the examples also use a duration.