Browse Source

Let services to manipulate timeout without knowing its channel

takasek 7 years ago
parent
commit
e3d1b814be
1 changed files with 10 additions and 0 deletions
  1. 10 0
      Plugin/Templates/client.swift

+ 10 - 0
Plugin/Templates/client.swift

@@ -40,6 +40,16 @@
     }
     }
   }
   }
 
 
+  /// This property allows the service timeout to be overridden.
+  {{ access }} var timeout : TimeInterval {
+    get {
+      return self.channel.timeout
+    }
+    set {
+      self.channel.timeout = newValue
+    }
+  }
+
   /// Create a client.
   /// Create a client.
   {{ access }} init(address: String, secure: Bool = true) {
   {{ access }} init(address: String, secure: Bool = true) {
     gRPC.initialize()
     gRPC.initialize()