Skip to content

Commit 6ffaf0c

Browse files
Enable Exclusive Transactions.
Without this, the Timeout value does nothing.
1 parent ef20175 commit 6ffaf0c

File tree

4 files changed

+22
-4
lines changed

4 files changed

+22
-4
lines changed

Core.Arango.Tests/TransactionTest.cs

+6-4
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,9 @@ public async Task StreamTransaction(string serializer)
2222
{
2323
Collections = new ArangoTransactionScope
2424
{
25-
Write = new List<string> {"test"}
26-
}
25+
Exclusive = ["test"]
26+
},
27+
AllowImplicit = false
2728
});
2829

2930
await Arango.Document.CreateManyAsync(t1, "test", new List<Entity>
@@ -41,8 +42,9 @@ public async Task StreamTransaction(string serializer)
4142
{
4243
Collections = new ArangoTransactionScope
4344
{
44-
Write = new List<string> {"test"}
45-
}
45+
Exclusive = ["test"]
46+
},
47+
AllowImplicit = false
4648
});
4749

4850
await Arango.Document.CreateManyAsync(t2, "test", new List<Entity>

Core.Arango/Core.Arango.xml

+6
Original file line numberDiff line numberDiff line change
@@ -5223,6 +5223,7 @@
52235223
An optional numeric value that can be used to set a timeout for waiting on collection locks.
52245224
If not specified, a default value will be used.
52255225
Setting lockTimeout to 0 will make ArangoDB not time out waiting for a lock.
5226+
This is only meaningful when using exclusive transaction locks.
52265227
</summary>
52275228
</member>
52285229
<member name="P:Core.Arango.Protocol.ArangoTransaction.Params">
@@ -5250,6 +5251,11 @@
52505251
Collections to write to
52515252
</summary>
52525253
</member>
5254+
<member name="P:Core.Arango.Protocol.ArangoTransactionScope.Exclusive">
5255+
<summary>
5256+
Collections to write to with an exclusive lock
5257+
</summary>
5258+
</member>
52535259
<member name="T:Core.Arango.Protocol.ArangoUpdateResult`1">
52545260
<summary>
52555261
Arango document update result

Core.Arango/Protocol/ArangoTransaction.cs

+1
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,7 @@ public class ArangoTransaction
5555
/// An optional numeric value that can be used to set a timeout for waiting on collection locks.
5656
/// If not specified, a default value will be used.
5757
/// Setting lockTimeout to 0 will make ArangoDB not time out waiting for a lock.
58+
/// This is only meaningful when using exclusive transaction locks.
5859
/// </summary>
5960
[JsonPropertyName("lockTimeout")]
6061
[JsonProperty(PropertyName = "lockTimeout", NullValueHandling = NullValueHandling.Ignore)]

Core.Arango/Protocol/ArangoTransactionScope.cs

+9
Original file line numberDiff line numberDiff line change
@@ -24,5 +24,14 @@ public class ArangoTransactionScope
2424
[JsonProperty(PropertyName = "write", NullValueHandling = NullValueHandling.Ignore)]
2525
[System.Text.Json.Serialization.JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]
2626
public List<string> Write { get; set; }
27+
28+
29+
/// <summary>
30+
/// Collections to write to with an exclusive lock
31+
/// </summary>
32+
[JsonPropertyName("exclusive")]
33+
[JsonProperty(PropertyName = "exclusive", NullValueHandling = NullValueHandling.Ignore)]
34+
[System.Text.Json.Serialization.JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]
35+
public List<string> Exclusive { get; set; }
2736
}
2837
}

0 commit comments

Comments
 (0)