Skip to content

Commit 006169a

Browse files
committed
DaJet 3.13.6
Прерывание цикла CONSUME для баз данных
1 parent 505929d commit 006169a

File tree

8 files changed

+77
-7
lines changed

8 files changed

+77
-7
lines changed

src/dajet-http-server/dajet-http-server.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
<ImplicitUsings>enable</ImplicitUsings>
77
<RootNamespace>DaJet.Http.Server</RootNamespace>
88
<AssemblyName>DaJet.Http.Server</AssemblyName>
9-
<Version>3.13.5</Version>
9+
<Version>3.13.6</Version>
1010
<Authors>Zhichkin</Authors>
1111
<Copyright>Zhichkin © 2022</Copyright>
1212
<Description>DaJet HTTP server for 1C:Enterprise 8 databases</Description>

src/dajet-runtime/adapters/rabbitmq/Producer.cs

Lines changed: 67 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
using DaJet.Data;
22
using DaJet.Scripting.Model;
3+
using Npgsql.Replication;
34
using RabbitMQ.Client;
45
using RabbitMQ.Client.Events;
56
using System.Buffers;
@@ -61,6 +62,66 @@ public Producer(in ScriptScope scope)
6162
private string VirtualHost { get; set; } = "/";
6263
private string UserName { get; set; } = "guest";
6364
private string Password { get; set; } = "guest";
65+
private TimeSpan GetRequestedHeartbeat()
66+
{
67+
if (StreamFactory.TryGetOption(in _scope, "RequestedHeartbeat", out object value))
68+
{
69+
if (value is int seconds)
70+
{
71+
return TimeSpan.FromSeconds(seconds);
72+
}
73+
}
74+
75+
return TimeSpan.FromSeconds(60);
76+
}
77+
private bool GetAutomaticRecoveryEnabled()
78+
{
79+
if (StreamFactory.TryGetOption(in _scope, "AutomaticRecoveryEnabled", out object value))
80+
{
81+
if (value is bool boolean)
82+
{
83+
return boolean;
84+
}
85+
}
86+
87+
return true;
88+
}
89+
private TimeSpan GetNetworkRecoveryInterval()
90+
{
91+
if (StreamFactory.TryGetOption(in _scope, "NetworkRecoveryInterval", out object value))
92+
{
93+
if (value is int seconds)
94+
{
95+
return TimeSpan.FromSeconds(seconds);
96+
}
97+
}
98+
99+
return TimeSpan.FromSeconds(5);
100+
}
101+
private TimeSpan GetContinuationTimeout()
102+
{
103+
if (StreamFactory.TryGetOption(in _scope, "ContinuationTimeout", out object value))
104+
{
105+
if (value is int seconds)
106+
{
107+
return TimeSpan.FromSeconds(seconds);
108+
}
109+
}
110+
111+
return TimeSpan.FromSeconds(30);
112+
}
113+
private TimeSpan GetRequestedConnectionTimeout()
114+
{
115+
if (StreamFactory.TryGetOption(in _scope, "RequestedConnectionTimeout", out object value))
116+
{
117+
if (value is int seconds)
118+
{
119+
return TimeSpan.FromSeconds(seconds);
120+
}
121+
}
122+
123+
return TimeSpan.FromSeconds(30);
124+
}
64125
#endregion
65126

66127
#region "MESSAGE OPTIONS AND VALUES"
@@ -291,7 +352,12 @@ private void InitializeConnection()
291352
Port = HostPort,
292353
VirtualHost = VirtualHost,
293354
UserName = UserName,
294-
Password = Password
355+
Password = Password,
356+
RequestedHeartbeat = GetRequestedHeartbeat(),
357+
ContinuationTimeout = GetContinuationTimeout(),
358+
RequestedConnectionTimeout = GetRequestedConnectionTimeout(),
359+
AutomaticRecoveryEnabled = GetAutomaticRecoveryEnabled(),
360+
NetworkRecoveryInterval = GetNetworkRecoveryInterval()
295361
};
296362

297363
_connection = factory.CreateConnection();

src/dajet-runtime/dajet-runtime.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
<ImplicitUsings>enable</ImplicitUsings>
77
<Nullable>disable</Nullable>
88
<AssemblyName>DaJet.Runtime</AssemblyName>
9-
<Version>3.13.5</Version>
9+
<Version>3.13.6</Version>
1010
<Authors>Zhichkin</Authors>
1111
<Copyright>Zhichkin © 2024</Copyright>
1212
<PackageProjectUrl>https://zhichkin.github.io/</PackageProjectUrl>

src/dajet-runtime/database/ConsumeProcessor.cs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,10 @@ private void WhileActiveDoWork()
4646
FileLogger.Default.Write($"Processed {processed} messages");
4747
}
4848
}
49+
catch (BreakException)
50+
{
51+
Dispose(); // STATE_ACTIVE -> STATE_DISPOSING -> STATE_IDLE
52+
}
4953
catch (Exception error)
5054
{
5155
delay = 60;

src/dajet-studio/Index.razor

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
@page "/"
22

3-
<h6>DaJet Studio © 3.13.5</h6>
3+
<h6>DaJet Studio © 3.13.6</h6>

src/dajet-studio/dajet-studio.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
<RootNamespace>DaJet.Studio</RootNamespace>
99
<PackageId>$(AssemblyName)</PackageId>
1010
<AssemblyName>DaJet.Studio</AssemblyName>
11-
<Version>3.13.5</Version>
11+
<Version>3.13.6</Version>
1212
<Authors>Zhichkin</Authors>
1313
<Copyright>Zhichkin © 2022</Copyright>
1414
<Description>DaJet HTTP server Blazor UI</Description>

src/dajet-studio/wwwroot/index.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
<head>
44
<meta charset="utf-8" />
55
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
6-
<title>DaJet Studio © 3.13.5</title>
6+
<title>DaJet Studio © 3.13.6</title>
77
<link rel="icon" href="/img/vuk.png" type="image/png">
88
<base href="/" />
99
<link href="css/app.css" rel="stylesheet" />

src/dajet/dajet.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
<RootNamespace>DaJet</RootNamespace>
99
<Authors>Zhichkin</Authors>
1010
<Copyright>Zhichkin © 2024</Copyright>
11-
<Version>3.13.5</Version>
11+
<Version>3.13.6</Version>
1212
<Title>DaJet Script Utility</Title>
1313
<PackageId>DaJet.Script.Utility</PackageId>
1414
<Product>DaJet Script Utility</Product>

0 commit comments

Comments
 (0)