Example #1
0
        public override Task OnActivateAsync()
        {
            // note: normally we would use dependency injection
            // but since we do not have access to the registered services collection
            // from within a bootstrapper we do it this way:
            // first try to resolve from the container, if not present in container
            // then instantiate the default
            this.siloDetailsProvider =
                (this.ServiceProvider.GetService(typeof(ISiloDetailsProvider)) as ISiloDetailsProvider)
                ?? new MembershipTableSiloDetailsProvider(this.GrainFactory);


            this.Counters = new DashboardCounters();
            this.RegisterTimer(this.Callback, null, TimeSpan.FromSeconds(1), TimeSpan.FromSeconds(1));
            this.StartTime = DateTime.UtcNow;
            return(base.OnActivateAsync());
        }
Example #2
0
        public DashboardGrain(IOptions <DashboardOptions> options, ISiloDetailsProvider siloDetailsProvider)
        {
            this.siloDetailsProvider = siloDetailsProvider;

            updateInterval = TimeSpan.FromMilliseconds(Math.Max(options.Value.CounterUpdateIntervalMs, DefaultTimerIntervalMs));
        }
 public DashboardGrain(IOptions <DashboardOptions> options, ISiloDetailsProvider siloDetailsProvider)
 {
     this.options             = options.Value;
     this.siloDetailsProvider = siloDetailsProvider;
 }