From c5bed0b22acece9fe14ce1af2776821038c78e7f Mon Sep 17 00:00:00 2001 From: Loretta Date: Wed, 22 Apr 2026 22:45:06 +0200 Subject: [PATCH] [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. --- .../Infrastructure/PluginNopStartup.cs | 30 ++++++++++++------- 1 file changed, 20 insertions(+), 10 deletions(-) diff --git a/Nop.Plugin.Misc.AIPlugin/Infrastructure/PluginNopStartup.cs b/Nop.Plugin.Misc.AIPlugin/Infrastructure/PluginNopStartup.cs index b1001a1..7f767d1 100644 --- a/Nop.Plugin.Misc.AIPlugin/Infrastructure/PluginNopStartup.cs +++ b/Nop.Plugin.Misc.AIPlugin/Infrastructure/PluginNopStartup.cs @@ -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(); }); + //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(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 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(sp => new AyCodeBinaryHubProtocol(sp.GetRequiredService())); + using var tmpSp = services.BuildServiceProvider(); + foreach (var p in tmpSp.GetServices()) + Console.WriteLine($">>> HubProtocol: Name={p.Name} v{p.Version} Assembly={p.GetType().Assembly.GetName().Name}"); } ///