-
Notifications
You must be signed in to change notification settings - Fork 82
Expand file tree
/
Copy pathClock+Extensions.swift
More file actions
28 lines (26 loc) · 1011 Bytes
/
Clock+Extensions.swift
File metadata and controls
28 lines (26 loc) · 1011 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
//===----------------------------------------------------------------------===//
//
// This source file is part of the Swift Distributed Actors open source project
//
// Copyright (c) 2018-2022 Apple Inc. and the Swift Distributed Actors project authors
// Licensed under Apache License v2.0
//
// See LICENSE.txt for license information
// See CONTRIBUTORS.md for the list of Swift Distributed Actors project authors
//
// SPDX-License-Identifier: Apache-2.0
//
//===----------------------------------------------------------------------===//
import _PrettyLogHandler
import Distributed
import DistributedCluster
import Logging
import NIO
import OpenTelemetry
import OtlpGRPCSpanExporting
import Tracing
// Sleep, with adding a little bit of noise (additional delay) to the duration.
func noisySleep(for duration: ContinuousClock.Duration) async {
var duration = duration + .milliseconds(Int.random(in: 200 ..< 500))
try? await Task.sleep(until: ContinuousClock.now + duration, clock: .continuous)
}