Skip to content

Commit

Permalink
Merge pull request #16 from raisedapp/develop
Browse files Browse the repository at this point in the history
Version 0.2.2
  • Loading branch information
felixclase authored Dec 23, 2019
2 parents c69d5de + 47f190d commit aa64e24
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 12 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
<TargetFrameworks>netstandard2.0;net45</TargetFrameworks>
</PropertyGroup>
<PropertyGroup>
<Version>0.2.1</Version>
<Version>0.2.2</Version>
<Authors>RaisedApp</Authors>
<Company>RaisedApp</Company>
<Copyright>Copyright © 2019 - Present</Copyright>
Expand All @@ -20,9 +20,10 @@
<title>Hangfire Storage SQLite</title>
<Description>An Alternative SQLite Storage for Hangfire</Description>
<PackageReleaseNotes>
0.2.1
0.2.2
- Add AutoVacuum Options
- Add ExpireAt In JobParamter And State Models
- Fix pragma sql
</PackageReleaseNotes>
</PropertyGroup>
<ItemGroup>
Expand Down
18 changes: 9 additions & 9 deletions src/main/Hangfire.Storage.SQLite/HangfireDbContext.cs
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,15 @@ public void Init(SQLiteStorageOptions storageOptions)
{
StorageOptions = storageOptions;

try
{
Database.Execute($@"PRAGMA auto_vacuum = '{(int)storageOptions.AutoVacuumSelected}'");
}
catch (Exception ex)
{
Logger.Log(LogLevel.Error, () => $"Error set auto vacuum mode. Details: {ex.ToString()}");
}

Database.CreateTable<AggregatedCounter>();
Database.CreateTable<Counter>();
Database.CreateTable<HangfireJob>();
Expand All @@ -107,15 +116,6 @@ public void Init(SQLiteStorageOptions storageOptions)
SetRepository = Database.Table<Set>();
StateRepository = Database.Table<State>();
DistributedLockRepository = Database.Table<DistributedLock>();

try
{
Database.Execute($"PRAGMA auto_vacuum = {(int) storageOptions.AutoVacuumSelected};");
}
catch (Exception ex)
{
Logger.Log(LogLevel.Error, () => $"Error set auto vacuum mode. Details: {ex.ToString()}");
}
}

public TableQuery<AggregatedCounter> AggregatedCounterRepository { get; private set; }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
<PackageReference Include="xunit" Version="2.4.0" />
<PackageReference Include="xunit.runner.visualstudio" Version="2.4.0" />
<PackageReference Include="coverlet.collector" Version="1.0.1" />
<PackageReference Include="Xunit.SkippableFact" Version="1.3.12" />
</ItemGroup>

<ItemGroup>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,7 @@ public void Ctor_WaitForLock_OnlySingleLockCanBeAcquired()
manualResetEvent.Wait();
// Attempt to acquire the distributed lock.
using (new SQLiteDistributedLock("resource1", TimeSpan.FromSeconds(5), connection, new SQLiteStorageOptions()))
using (new SQLiteDistributedLock("resource1", TimeSpan.FromSeconds(10), connection, new SQLiteStorageOptions()))
{
// Find out if any other threads managed to acquire the lock.
var oldConcurrencyCounter = Interlocked.CompareExchange(ref concurrencyCounter, 1, 0);
Expand Down

0 comments on commit aa64e24

Please sign in to comment.