Skip to content

Commit b153917

Browse files
Code for 1.1.2045
* Fixed bug in GetRangeFromSet * Simplify code in ExpirationManager * Code cleanup
1 parent a73708c commit b153917

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

42 files changed

+281
-288
lines changed

Hangfire.FluentNHibernateStorage/CountersAggregator.cs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -53,20 +53,20 @@ public void Execute(CancellationToken cancellationToken)
5353
expireAt = i.Max(counter => counter.ExpireAt)
5454
})
5555
.ToList();
56-
var query = session.CreateQuery(SQLHelper.UpdateAggregateCounterSql);
56+
var query = session.CreateQuery(SqlUtil.UpdateAggregateCounterSql);
5757

5858
foreach (var item in countersByName)
5959
{
6060
if (item.expireAt.HasValue)
6161
{
62-
query.SetParameter(SQLHelper.ValueParameter2Name, item.expireAt.Value);
62+
query.SetParameter(SqlUtil.ValueParameter2Name, item.expireAt.Value);
6363
}
6464
else
6565
{
66-
query.SetParameter(SQLHelper.ValueParameter2Name, null);
66+
query.SetParameter(SqlUtil.ValueParameter2Name, null);
6767
}
68-
if (query.SetString(SQLHelper.IdParameterName, item.Key)
69-
.SetParameter(SQLHelper.ValueParameterName, item.value)
68+
if (query.SetString(SqlUtil.IdParameterName, item.Key)
69+
.SetParameter(SqlUtil.ValueParameterName, item.value)
7070
.ExecuteUpdate() == 0)
7171
{
7272
session.Insert(new _AggregatedCounter

Hangfire.FluentNHibernateStorage/DateHelper.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,11 @@ namespace Hangfire.FluentNHibernateStorage
44
{
55
internal static class DateHelper
66
{
7-
public static readonly DateTime horizon = new DateTime(1970, 1, 1);
7+
public static readonly DateTime Horizon = new DateTime(1970, 1, 1);
88

99
public static long ToUnixDate(this DateTime dt)
1010
{
11-
return Convert.ToInt64(dt.Subtract(horizon).TotalMilliseconds);
11+
return Convert.ToInt64(dt.Subtract(Horizon).TotalMilliseconds);
1212
}
1313
}
1414
}

Hangfire.FluentNHibernateStorage/Entities/EntityBase0.cs renamed to Hangfire.FluentNHibernateStorage/Entities/Int64IdBase.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
namespace Hangfire.FluentNHibernateStorage.Entities
22
{
3-
public abstract class EntityBase0 : IInt64Id
3+
public abstract class Int64IdBase : IInt64Id
44
{
55
public virtual long Id { get; set; }
66
}

Hangfire.FluentNHibernateStorage/Entities/EntityBase1.cs renamed to Hangfire.FluentNHibernateStorage/Entities/KeyValueTypeBase.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
namespace Hangfire.FluentNHibernateStorage.Entities
44
{
5-
public abstract class EntityBase1<T> : EntityBase0, IExpirableWithKey, IExpirableWithId
5+
public abstract class KeyValueTypeBase<T> : Int64IdBase, IExpirableWithKey, IExpirableWithId
66
{
77
public virtual T Value { get; set; }
88
public virtual string Key { get; set; }
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
namespace Hangfire.FluentNHibernateStorage.Entities
22
{
3-
public class _AggregatedCounter : EntityBase1<long>
3+
public class _AggregatedCounter : KeyValueTypeBase<long>
44
{
55
}
66
}
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
namespace Hangfire.FluentNHibernateStorage.Entities
22
{
3-
public class _Counter : EntityBase1<long>
3+
public class _Counter : KeyValueTypeBase<long>
44
{
55
}
66
}

Hangfire.FluentNHibernateStorage/Entities/_DistributedLock.cs

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,14 +2,18 @@
22

33
namespace Hangfire.FluentNHibernateStorage.Entities
44
{
5-
public class _DistributedLock : EntityBase0
5+
public class _DistributedLock : Int64IdBase
66
{
77
public _DistributedLock()
88
{
99
CreatedAt = DateTime.UtcNow;
1010
ExpireAtAsLong = DateTime.Now.ToUnixDate();
1111
}
1212

13+
/// <summary>
14+
/// This is a long integer because NHibernate's default storage for dates
15+
/// doesn't have accuracy smaller than 1 second.
16+
/// </summary>
1317
public virtual long ExpireAtAsLong { get; set; }
1418
public virtual string Resource { get; set; }
1519
public virtual DateTime CreatedAt { get; set; }
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
namespace Hangfire.FluentNHibernateStorage.Entities
22
{
3-
public class _Dual : EntityBase0
3+
public class _Dual : Int64IdBase
44
{
55
}
66
}

Hangfire.FluentNHibernateStorage/Entities/_Hash.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
namespace Hangfire.FluentNHibernateStorage.Entities
22
{
3-
public class _Hash : EntityBase1<string>
3+
public class _Hash : KeyValueTypeBase<string>
44
{
55
public virtual string Field { get; set; }
66
}

Hangfire.FluentNHibernateStorage/Entities/_JobParameter.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
namespace Hangfire.FluentNHibernateStorage.Entities
22
{
3-
public class _JobParameter : EntityBase0
3+
public class _JobParameter : Int64IdBase
44
{
55
public virtual string Name { get; set; }
66
public virtual string Value { get; set; }

0 commit comments

Comments
 (0)