private void MetadataSender_Elapsed(object sender, ElapsedEventArgs e) { // we do not need to enque another metadata sending event as the data update superseeds the metadata one. if (DataSender.Enabled) { return; } ; var payload = new PayloadStreamMetaUpdate(); payload.Layers = BucketLayers; payload.Name = BucketName; Task[] tasks = new Task[2] { mySender.StreamUpdateNameAsync(new PayloadStreamNameUpdate() { Name = BucketName }, mySender.StreamId), mySender.ReplaceLayersAsync(new PayloadMultipleLayers() { Layers = BucketLayers }, mySender.StreamId) }; Task.WhenAll(tasks).ContinueWith(task => { Log += "Metadata updated."; mySender.BroadcastMessage(new { eventType = "update-meta" }); }); }