Skip to content

Commit

Permalink
update
Browse files Browse the repository at this point in the history
  • Loading branch information
Wojciech Turowicz committed Dec 1, 2023
1 parent 833ab71 commit 42427d6
Show file tree
Hide file tree
Showing 4 changed files with 26 additions and 12 deletions.
4 changes: 2 additions & 2 deletions .vscode/launch.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
"program": "${workspaceFolder}/src/Orleans.Streaming.Grains.Performance/bin/Release/net7.0/Orleans.Streaming.Grains.Performance.dll",
"args": [
"--filter",
"*Broadcast*",
"*Channel*",
"-m",
"-t"
],
Expand All @@ -25,7 +25,7 @@
"program": "${workspaceFolder}/src/Orleans.Streaming.Grains.Performance/bin/Debug/net7.0/Orleans.Streaming.Grains.Performance.dll",
"args": [
"--filter",
"*Broadcast*",
"*Channel*",
"-m",
"-t"
],
Expand Down
6 changes: 0 additions & 6 deletions .vscode/tasks.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,6 @@
"kind": "build",
"isDefault": true
},
"presentation": {
"reveal": "silent"
},
"problemMatcher": "$msCompile"
},
{
Expand All @@ -41,9 +38,6 @@
"group": {
"kind": "build",
},
"presentation": {
"reveal": "silent"
},
"problemMatcher": "$msCompile"
}
]
Expand Down
12 changes: 10 additions & 2 deletions src/Orleans.Streaming.Grains.Performance/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -17,14 +17,22 @@ public static void Main(string[] args)
#if DEBUG
RunVerbose(args);
#else
// Run(args);
RunSummaries(args);
#endif
}

private static void Run(string[] args)
{
var config = DefaultConfig.Instance;

BenchmarkSwitcher.FromAssembly(typeof(Program).Assembly)
.Run(args, config);
}

private static void RunVerbose(string[] args)
{
var config = DefaultConfig.Instance
.WithOptions(ConfigOptions.DisableOptimizationsValidator);
var config = new DebugInProcessConfig();

BenchmarkSwitcher.FromAssembly(typeof(Program).Assembly)
.Run(args, config);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
// Copyright (c) Surveily Sp. z o.o.. All rights reserved.
// </copyright>

using System.Text;
using Orleans.BroadcastChannel;
using Orleans.Providers;
using Orleans.Runtime;
Expand Down Expand Up @@ -43,8 +44,19 @@ public override async Task OnActivateAsync(CancellationToken cancellationToken)

public async Task OnSubscribed(IBroadcastChannelSubscription subscription)
{
await subscription.Attach<BlobMessage>(OnNextAsync);
await subscription.Attach<BroadcastMessage>(OnBroadcastAsync);
var id = subscription.ChannelId;
var message = Encoding.Default.GetString(id.Namespace.ToArray());

// TODO: Channels don't support multiple subs.
if (message == nameof(BlobMessage))
{
await subscription.Attach<BlobMessage>(OnNextAsync);
}

if (message == nameof(BroadcastMessage))
{
await subscription.Attach<BroadcastMessage>(OnBroadcastAsync);
}
}

private async Task OnNextAsync(BlobMessage message)
Expand Down

0 comments on commit 42427d6

Please sign in to comment.