Move On-call services under a base class
Look at putting the oncall services under a base class, potentially BaseService
or create a new base class which might be able to remove some method repetition, such as available?
checks.
The following discussion from !49194 (merged) should be addressed:
-
@splattael started a discussion: (+1 comment) Suggestion Mostly services inherit from
BaseService
(and alike). It's not always possible to do so.I wonder, however, if we could inherit from
BaseService
orBaseContainerService
in this case and passschedule
toexecute(schedule)
(as we are doing in other service as well: https://gitlab.com/gitlab-org/gitlab/-/blob/b8f7418aafe57ce227e5d2d5e0d9cd24fa6271fa/app/services/merge_requests/reopen_service.rb#L5).Alternatively, if we really want to roll own our class (which is also fine), we could match the argument position which is usually:
project
,current_user
,params
or in this case:def initialize(project, current_user, schedule, params)
Personally, I'd slightly prefer to inherit from
BaseService
orBaseContainerService
.WDYT?