Skip to content

Commit

Permalink
Change parameter type, introduce exception for 0 length
Browse files Browse the repository at this point in the history
  • Loading branch information
Aistis Olendra committed Feb 3, 2023
1 parent 8a8b6d6 commit bc97589
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 4 deletions.
2 changes: 1 addition & 1 deletion src/Hangfire.Core/Storage/IMonitoringApi.cs
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ public interface IMonitoringApi

JobList<ProcessingJobDto> ProcessingJobs(int from, int count);
JobList<ScheduledJobDto> ScheduledJobs(int from, int count);
JobList<ScheduledJobDto> ScheduledJobsByIds(IEnumerable<long> jobIds);
JobList<ScheduledJobDto> ScheduledJobsByIds(long[] jobIds);
JobList<SucceededJobDto> SucceededJobs(int from, int count);
JobList<FailedJobDto> FailedJobs(int from, int count);
JobList<DeletedJobDto> DeletedJobs(int from, int count);
Expand Down
2 changes: 1 addition & 1 deletion src/Hangfire.Core/Storage/JobStorageMonitor.cs
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ public abstract class JobStorageMonitor : IMonitoringApi
public abstract JobList<FetchedJobDto> FetchedJobs(string queue, int from, int perPage);
public abstract JobList<ProcessingJobDto> ProcessingJobs(int from, int count);
public abstract JobList<ScheduledJobDto> ScheduledJobs(int from, int count);
public abstract JobList<ScheduledJobDto> ScheduledJobsByIds(IEnumerable<long> jobIds);
public abstract JobList<ScheduledJobDto> ScheduledJobsByIds(long[] jobIds);
public abstract JobList<SucceededJobDto> SucceededJobs(int from, int count);
public abstract JobList<FailedJobDto> FailedJobs(int from, int count);
public abstract JobList<DeletedJobDto> DeletedJobs(int from, int count);
Expand Down
7 changes: 5 additions & 2 deletions src/Hangfire.SqlServer/SqlServerMonitoringApi.cs
Original file line number Diff line number Diff line change
Expand Up @@ -114,8 +114,11 @@ public override JobList<ScheduledJobDto> ScheduledJobs(int @from, int count)
}));
}

public override JobList<ScheduledJobDto> ScheduledJobsByIds(IEnumerable<long> jobIds)
public override JobList<ScheduledJobDto> ScheduledJobsByIds(long[] jobIds)
{
if (jobIds.Length == 0)
throw new InvalidOperationException("Sequence contains no elements");

return UseConnection(connection => GetJobsByIdsList(
connection,
jobIds,
Expand Down Expand Up @@ -646,7 +649,7 @@ private JobList<TDto> GetJobs<TDto>(

private JobList<TDto> GetJobsByIdsList<TDto>(
DbConnection connection,
IEnumerable<long> jobIds,
long[] jobIds,
string stateName,
Func<SqlJob, Job, InvocationData, JobLoadException, SafeDictionary<string, string>, TDto> selector)
{
Expand Down

0 comments on commit bc97589

Please sign in to comment.