Skip to content

Commit

Permalink
Move Cronos to Foundatio namespace to prevent collisions.
Browse files Browse the repository at this point in the history
  • Loading branch information
ejsmith committed Jul 26, 2024
1 parent 303146b commit 8d4f35c
Show file tree
Hide file tree
Showing 9 changed files with 12 additions and 9 deletions.
2 changes: 1 addition & 1 deletion src/Foundatio.Extensions.Hosting/Cronos/CalendarHelper.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
using System;
using System.Runtime.CompilerServices;

namespace Cronos;
namespace Foundatio.Extensions.Hosting.Cronos;

internal static class CalendarHelper
{
Expand Down
2 changes: 1 addition & 1 deletion src/Foundatio.Extensions.Hosting/Cronos/CronExpression.cs
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
using System.Runtime.CompilerServices;
using System.Text;

namespace Cronos;
namespace Foundatio.Extensions.Hosting.Cronos;

/// <summary>
/// Provides a parser and scheduler for cron expressions.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@

using System;

namespace Cronos;
namespace Foundatio.Extensions.Hosting.Cronos;

[Flags]
internal enum CronExpressionFlag : byte
Expand Down
2 changes: 1 addition & 1 deletion src/Foundatio.Extensions.Hosting/Cronos/CronField.cs
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
// SOFTWARE.

namespace Cronos;
namespace Foundatio.Extensions.Hosting.Cronos;

internal sealed class CronField
{
Expand Down
2 changes: 1 addition & 1 deletion src/Foundatio.Extensions.Hosting/Cronos/CronFormat.cs
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@

using System;

namespace Cronos;
namespace Foundatio.Extensions.Hosting.Cronos;

/// <summary>
/// Defines the cron format options that customize string parsing for <see cref="CronExpression.Parse(string, CronFormat)"/>.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@

using System;

namespace Cronos;
namespace Foundatio.Extensions.Hosting.Cronos;

/// <summary>
/// Represents an exception that's thrown, when invalid Cron expression is given.
Expand Down
2 changes: 1 addition & 1 deletion src/Foundatio.Extensions.Hosting/Cronos/TimeZoneHelper.cs
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@

using System;

namespace Cronos;
namespace Foundatio.Extensions.Hosting.Cronos;

internal static class TimeZoneHelper
{
Expand Down
5 changes: 4 additions & 1 deletion src/Foundatio.Extensions.Hosting/Jobs/ScheduledJobManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -40,9 +40,12 @@ public ScheduledJobManager(IServiceProvider serviceProvider, ILoggerFactory logg
{
_serviceProvider = serviceProvider;
_loggerFactory = loggerFactory;
_cacheClient = serviceProvider.GetService<ICacheClient>() ?? new InMemoryCacheClient(o => o.LoggerFactory(loggerFactory));
var cacheClient = serviceProvider.GetService<ICacheClient>();
_jobs.AddRange(serviceProvider.GetServices<ScheduledJobRegistration>().Select(j => new ScheduledJobRunner(j.Options, serviceProvider, _cacheClient, loggerFactory)));
_jobsArray = _jobs.ToArray();
if (_jobs.Any(j => j.Options.IsDistributed && cacheClient == null))
throw new ArgumentException("A distributed cache client is required to run distributed jobs.");
_cacheClient = cacheClient ?? new InMemoryCacheClient(o => o.LoggerFactory(loggerFactory));
}

public void AddOrUpdate<TJob>(string cronSchedule, Action<ScheduledJobOptionsBuilder> configure = null) where TJob : class, IJob
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@
using System.Diagnostics;
using System.Threading;
using System.Threading.Tasks;
using Cronos;
using Foundatio.Caching;
using Foundatio.Extensions.Hosting.Cronos;
using Foundatio.Jobs;
using Foundatio.Lock;
using Foundatio.Utility;
Expand Down

0 comments on commit 8d4f35c

Please sign in to comment.