chore: cleanup
This commit is contained in:
@@ -13,7 +13,8 @@ namespace GodotHostTest.Game.Level;
|
||||
|
||||
public partial class LevelServiceSource : ServiceSource
|
||||
{
|
||||
private Activity? _activityValue;
|
||||
private Activity? _levelActivity;
|
||||
|
||||
[Export] private TargetSpawner _targetSpawner = null!;
|
||||
|
||||
protected override void OnScopeCreated(IProvider serviceProvider)
|
||||
@@ -22,15 +23,13 @@ public partial class LevelServiceSource : ServiceSource
|
||||
}
|
||||
|
||||
[WithProvider]
|
||||
private void OnScopeCreated(IValueSetter<ITargetCollector> targetCollector,
|
||||
IValueSetter<ITargetSpawner> targetSpawner, IActivitySourceFactory activitySourceFactory,
|
||||
IValueSetter<Activity> activity)
|
||||
private void OnScopeCreated(IActivitySourceFactory activitySourceFactory,
|
||||
IValueSetter<ITargetCollector> targetCollector, IValueSetter<ITargetSpawner> targetSpawner)
|
||||
{
|
||||
// ReSharper disable once ExplicitCallerInfoArgument - the caller name is not significant in this case
|
||||
_activityValue = activitySourceFactory.ActivitySource.StartActivity("Level") ??
|
||||
_levelActivity = activitySourceFactory.ActivitySource.StartActivity("Level") ??
|
||||
throw new InvalidOperationException(
|
||||
"No listeners for the activity - is OpenTelemetry running?");
|
||||
activity.Set(_activityValue);
|
||||
targetCollector.Set(_targetSpawner);
|
||||
targetSpawner.Set(_targetSpawner);
|
||||
}
|
||||
@@ -38,6 +37,6 @@ public partial class LevelServiceSource : ServiceSource
|
||||
public override void _Ready()
|
||||
{
|
||||
// after 3 seconds, dispose the activity for simulation purposes
|
||||
GetTree().CreateTimer(3).Timeout += _activityValue!.Dispose;
|
||||
GetTree().CreateTimer(3).Timeout += _levelActivity!.Dispose;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user