Skip to content

Commit

Permalink
Special version to support Hangfire 1.7.0
Browse files Browse the repository at this point in the history
  • Loading branch information
odinserj committed Sep 18, 2024
1 parent c1db106 commit 1f2db0c
Show file tree
Hide file tree
Showing 9 changed files with 30 additions and 23 deletions.
2 changes: 1 addition & 1 deletion appveyor.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
#---------------------------------#

# Please don't edit it manually, use the `build.bat version` command instead.
version: 1.0.0-build-0{build}
version: 0.11.0-build-0{build}

image:
- Visual Studio 2022
Expand Down
7 changes: 4 additions & 3 deletions nuspecs/Hangfire.InMemory.nuspec
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,8 @@
<copyright>Copyright © 2020-2024 Hangfire OÜ</copyright>
<tags>Hangfire Storage In-Memory</tags>
<releaseNotes>https://github.com/HangfireIO/Hangfire.InMemory/releases
1.0.0
0.11.0
• Changed – This version targets Hangfire 1.7.0 and don't support some of the newest features.
• Breaking – Remove the deprecated `DisableJobSerialization` option.
• Breaking – Change default value for the `IdType` option to `long`.

Expand Down Expand Up @@ -157,10 +158,10 @@
</releaseNotes>
<dependencies>
<group targetFramework="net451">
<dependency id="Hangfire.Core" version="1.8.0" />
<dependency id="Hangfire.Core" version="1.7.0" />
</group>
<group targetFramework="netstandard2.0">
<dependency id="Hangfire.Core" version="1.8.0" />
<dependency id="Hangfire.Core" version="1.7.0" />
</group>
</dependencies>
</metadata>
Expand Down
2 changes: 1 addition & 1 deletion samples/ConsoleSample/packages.lock.json
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@
"hangfire.inmemory": {
"type": "Project",
"dependencies": {
"Hangfire.Core": "[1.8.0, )",
"Hangfire.Core": "[1.7.0, )",
"Microsoft.CodeAnalysis.NetAnalyzers": "[8.0.0, )",
"Microsoft.SourceLink.GitHub": "[8.0.0, )"
}
Expand Down
2 changes: 1 addition & 1 deletion src/Hangfire.InMemory/Hangfire.InMemory.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<TargetFrameworks>net451;netstandard2.0</TargetFrameworks>
<LangVersion>Latest</LangVersion>
<Nullable>enable</Nullable>
<DefineConstants>$(DefineConstants);HANGFIRE_180</DefineConstants>
<DefineConstants>$(DefineConstants);HANGFIRE_170</DefineConstants>
</PropertyGroup>

<ItemGroup Condition="'$(TargetFramework)'=='net451'">
Expand Down
6 changes: 6 additions & 0 deletions src/Hangfire.InMemory/InMemoryTransaction.cs
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,9 @@ internal sealed class InMemoryTransaction<TKey> : JobStorageTransaction
private readonly List<ICommand<TKey>> _commands = new List<ICommand<TKey>>();
private LinkedList<ICommand<TKey>>? _additionalCommands;

#if !HANGFIRE_170
private List<IDisposable>? _acquiredLocks;
#endif
private HashSet<string>? _enqueued;

public InMemoryTransaction([NotNull] InMemoryConnection<TKey> connection)
Expand All @@ -43,13 +45,15 @@ public InMemoryTransaction([NotNull] InMemoryConnection<TKey> connection)

public override void Dispose()
{
#if !HANGFIRE_170
if (_acquiredLocks != null)
{
foreach (var acquiredLock in _acquiredLocks)
{
acquiredLock.Dispose();
}
}
#endif

base.Dispose();
}
Expand Down Expand Up @@ -390,13 +394,15 @@ private bool CommitCore(MemoryState<TKey> state)
}
finally
{
#if !HANGFIRE_170
if (_acquiredLocks != null)
{
foreach (var acquiredLock in _acquiredLocks)
{
acquiredLock.Dispose();
}
}
#endif
}

if (_enqueued != null)
Expand Down
12 changes: 6 additions & 6 deletions src/Hangfire.InMemory/packages.lock.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@
".NETFramework,Version=v4.5.1": {
"Hangfire.Core": {
"type": "Direct",
"requested": "[1.8.0, )",
"resolved": "1.8.0",
"contentHash": "YyQwi1iKCS4HsKnwUhY5dcyxOeJ0MqA/0gjeTJdMsCXufKl73I+y8mS5MbvQBIKMGcjv0FYzjLA+v31P6G+CRw==",
"requested": "[1.7.0, )",
"resolved": "1.7.0",
"contentHash": "ZWfWcE+kOWjKy7l/rsVtZmxs5XdltJY5ndx+vy7enD85ZVgc0Z+nIOZ/PfBhQQ68vGOfwOudpQVHuwXlSn7/fQ==",
"dependencies": {
"Newtonsoft.Json": "5.0.1",
"Owin": "1.0.0"
Expand Down Expand Up @@ -66,9 +66,9 @@
".NETStandard,Version=v2.0": {
"Hangfire.Core": {
"type": "Direct",
"requested": "[1.8.0, )",
"resolved": "1.8.0",
"contentHash": "YyQwi1iKCS4HsKnwUhY5dcyxOeJ0MqA/0gjeTJdMsCXufKl73I+y8mS5MbvQBIKMGcjv0FYzjLA+v31P6G+CRw==",
"requested": "[1.7.0, )",
"resolved": "1.7.0",
"contentHash": "ZWfWcE+kOWjKy7l/rsVtZmxs5XdltJY5ndx+vy7enD85ZVgc0Z+nIOZ/PfBhQQ68vGOfwOudpQVHuwXlSn7/fQ==",
"dependencies": {
"Newtonsoft.Json": "11.0.1"
}
Expand Down
2 changes: 1 addition & 1 deletion src/SharedAssemblyInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -11,4 +11,4 @@
[assembly: CLSCompliant(true)]

// Please don't edit it manually, use the `build.bat version` command instead.
[assembly: AssemblyVersion("1.0.0")]
[assembly: AssemblyVersion("0.11.0")]
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<PropertyGroup>
<TargetFrameworks>net452;netcoreapp3.1;net6.0</TargetFrameworks>
<LangVersion>Latest</LangVersion>
<DefineConstants>$(DefineConstants);HANGFIRE_180</DefineConstants>
<DefineConstants>$(DefineConstants);HANGFIRE_170</DefineConstants>
</PropertyGroup>

<ItemGroup Condition="'$(TargetFramework)'=='net452'">
Expand Down
18 changes: 9 additions & 9 deletions tests/Hangfire.InMemory.Tests/packages.lock.json
Original file line number Diff line number Diff line change
Expand Up @@ -66,8 +66,8 @@
},
"Hangfire.Core": {
"type": "Transitive",
"resolved": "1.8.0",
"contentHash": "YyQwi1iKCS4HsKnwUhY5dcyxOeJ0MqA/0gjeTJdMsCXufKl73I+y8mS5MbvQBIKMGcjv0FYzjLA+v31P6G+CRw==",
"resolved": "1.7.0",
"contentHash": "ZWfWcE+kOWjKy7l/rsVtZmxs5XdltJY5ndx+vy7enD85ZVgc0Z+nIOZ/PfBhQQ68vGOfwOudpQVHuwXlSn7/fQ==",
"dependencies": {
"Newtonsoft.Json": "11.0.1"
}
Expand Down Expand Up @@ -1216,7 +1216,7 @@
"hangfire.inmemory": {
"type": "Project",
"dependencies": {
"Hangfire.Core": "[1.8.0, )",
"Hangfire.Core": "[1.7.0, )",
"Microsoft.CodeAnalysis.NetAnalyzers": "[8.0.0, )",
"Microsoft.SourceLink.GitHub": "[8.0.0, )"
}
Expand Down Expand Up @@ -1273,8 +1273,8 @@
},
"Hangfire.Core": {
"type": "Transitive",
"resolved": "1.8.0",
"contentHash": "YyQwi1iKCS4HsKnwUhY5dcyxOeJ0MqA/0gjeTJdMsCXufKl73I+y8mS5MbvQBIKMGcjv0FYzjLA+v31P6G+CRw==",
"resolved": "1.7.0",
"contentHash": "ZWfWcE+kOWjKy7l/rsVtZmxs5XdltJY5ndx+vy7enD85ZVgc0Z+nIOZ/PfBhQQ68vGOfwOudpQVHuwXlSn7/fQ==",
"dependencies": {
"Newtonsoft.Json": "5.0.1",
"Owin": "1.0.0"
Expand Down Expand Up @@ -1372,7 +1372,7 @@
"hangfire.inmemory": {
"type": "Project",
"dependencies": {
"Hangfire.Core": "[1.8.0, )",
"Hangfire.Core": "[1.7.0, )",
"Microsoft.CodeAnalysis.NetAnalyzers": "[8.0.0, )",
"Microsoft.NETFramework.ReferenceAssemblies": "[1.0.3, )",
"Microsoft.SourceLink.GitHub": "[8.0.0, )"
Expand Down Expand Up @@ -1444,8 +1444,8 @@
},
"Hangfire.Core": {
"type": "Transitive",
"resolved": "1.8.0",
"contentHash": "YyQwi1iKCS4HsKnwUhY5dcyxOeJ0MqA/0gjeTJdMsCXufKl73I+y8mS5MbvQBIKMGcjv0FYzjLA+v31P6G+CRw==",
"resolved": "1.7.0",
"contentHash": "ZWfWcE+kOWjKy7l/rsVtZmxs5XdltJY5ndx+vy7enD85ZVgc0Z+nIOZ/PfBhQQ68vGOfwOudpQVHuwXlSn7/fQ==",
"dependencies": {
"Newtonsoft.Json": "11.0.1"
}
Expand Down Expand Up @@ -2594,7 +2594,7 @@
"hangfire.inmemory": {
"type": "Project",
"dependencies": {
"Hangfire.Core": "[1.8.0, )",
"Hangfire.Core": "[1.7.0, )",
"Microsoft.CodeAnalysis.NetAnalyzers": "[8.0.0, )",
"Microsoft.SourceLink.GitHub": "[8.0.0, )"
}
Expand Down

0 comments on commit 1f2db0c

Please sign in to comment.