[LOADED_DOCS: .github\copilot-instructions.md]
Update DB config, docs, and SignalR binary protocol setup - Switched appsettings.json connection string to production DB. - Added "Shared Agent Skills" section to copilot-instructions.md in both main and Mango.Nop Libraries repos. - Refactored PluginNopStartup.cs: improved using statements, updated SignalR to use AddAcBinaryProtocol with explicit options, removed manual IHubProtocol registration, and added protocol diagnostics. - No business logic changes; focused on configuration, documentation, and infrastructure.
This commit is contained in:
parent
98f3000794
commit
c5bed0b22a
|
|
@ -1,6 +1,8 @@
|
|||
//using AyCode.Core.Loggers;
|
||||
|
||||
using AyCode.Core.Loggers;
|
||||
using AyCode.Core.Serializers.Binaries;
|
||||
using AyCode.Services.Server.SignalRs;
|
||||
using AyCode.Services.SignalRs;
|
||||
using DevExpress.AspNetCore;
|
||||
using FruitBank.Common;
|
||||
|
|
@ -17,6 +19,7 @@ using Microsoft.AspNetCore.SignalR;
|
|||
using Microsoft.AspNetCore.SignalR.Protocol;
|
||||
using Microsoft.Extensions.Configuration;
|
||||
using Microsoft.Extensions.DependencyInjection;
|
||||
using Microsoft.Extensions.Logging;
|
||||
using Nop.Core.Domain.Orders;
|
||||
using Nop.Core.Infrastructure;
|
||||
using Nop.Data;
|
||||
|
|
@ -36,7 +39,7 @@ using Nop.Web.Areas.Admin.Factories;
|
|||
using Nop.Web.Areas.Admin.Models.Catalog;
|
||||
using Nop.Web.Areas.Admin.Models.Orders;
|
||||
using System.Net.Http.Headers;
|
||||
using AyCode.Core.Serializers.Binaries;
|
||||
using Mango.Nop.Core.Loggers;
|
||||
|
||||
namespace Nop.Plugin.Misc.FruitBankPlugin.Infrastructure;
|
||||
|
||||
|
|
@ -141,6 +144,12 @@ public class PluginNopStartup : INopStartup
|
|||
options.Filters.AddService<PendingMeasurementCheckoutFilter>();
|
||||
});
|
||||
|
||||
//services.AddLogging(logging =>
|
||||
//{
|
||||
// logging.SetMinimumLevel(Microsoft.Extensions.Logging.LogLevel.Error);
|
||||
// //logging.AddAcLogger(category => new Logger(category)); //Minden .net az aclogger-t használja.
|
||||
//});
|
||||
|
||||
services.AddSignalR(hubOptions =>
|
||||
{
|
||||
hubOptions.EnableDetailedErrors = true;
|
||||
|
|
@ -151,18 +160,19 @@ public class PluginNopStartup : INopStartup
|
|||
//hubOptions.MaximumParallelInvocationsPerClient = 1; //default: 1;
|
||||
hubOptions.StatefulReconnectBufferSize = 30_000_000; //30MB; //default: 100,000 bytes;
|
||||
//hubOptions.HandshakeTimeout = TimeSpan.FromSeconds(15); //default timeout is 15 seconds
|
||||
});
|
||||
|
||||
services.AddSingleton<IHubProtocol>(sp =>
|
||||
})
|
||||
.AddAcBinaryProtocol(opts =>
|
||||
{
|
||||
var binaryOptions = AcBinarySerializerOptions.Default;
|
||||
binaryOptions.BufferWriterChunkSize = 4096;
|
||||
|
||||
return new AyCodeBinaryHubProtocol(binaryOptions);
|
||||
opts.ProtocolMode = BinaryProtocolMode.AsyncSegment;
|
||||
// Explicit AcLogger instance (name-based category, matches the previous setup).
|
||||
// If omitted, the options extension falls back to ILogger<AcBinaryHubProtocol> from DI.
|
||||
opts.Logger = new Logger(nameof(AyCodeBinaryHubProtocol));
|
||||
// opts.FlushTimeout = TimeSpan.FromSeconds(10); // default — ~65 KB chunks transfer in ≤9s even on GPRS
|
||||
});
|
||||
|
||||
//Vagy ha az options-t is DI-ből:
|
||||
//hubBuilder.Services.AddSingleton<IHubProtocol>(sp => new AyCodeBinaryHubProtocol(sp.GetRequiredService<AcBinarySerializerOptions>()));
|
||||
using var tmpSp = services.BuildServiceProvider();
|
||||
foreach (var p in tmpSp.GetServices<IHubProtocol>())
|
||||
Console.WriteLine($">>> HubProtocol: Name={p.Name} v{p.Version} Assembly={p.GetType().Assembly.GetName().Name}");
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
|
|
|||
Loading…
Reference in New Issue