예제 #1
0
파일: context.py 프로젝트: wuyongwen/doge
 def get_ha(self) -> Union[FailOverHA, BackupRequestHA]:
     name = self.url.get_param("haStrategy", "failover")
     if name == "failover":
         return FailOverHA(self.url)
     elif name == "backupRequestHA":
         return BackupRequestHA(self.url)
     raise ReferCfgError
예제 #2
0
 def test_br(self, server, lb):
     ha = BackupRequestHA(lb.url)
     r = Request("", "sum", 1, 2)
     assert ha.call(r, lb).value == 3
     lb.url.set_param("sum.retries", 5)
     assert ha.call(r, lb).value == 3
예제 #3
0
 def get_ha(self):
     name = self.url.get_param("haStrategy", "failover")
     if name == "failover":
         return FailOverHA(self.url)
     elif name == "backupRequestHA":
         return BackupRequestHA(self.url)
예제 #4
0
 def get_ha(self):
     name = self.url.get_param('haStrategy', 'failover')
     if name == 'failover':
         return FailOverHA(self.url)
     elif name == 'backupRequestHA':
         return BackupRequestHA(self.url)