(fun)
| 145 | retry=False): |
| 146 | |
| 147 | def _connect_signal(fun): |
| 148 | |
| 149 | options = {'dispatch_uid': dispatch_uid, |
| 150 | 'weak': weak} |
| 151 | |
| 152 | def _retry_receiver(retry_fun): |
| 153 | |
| 154 | def _try_receiver_over_time(*args, **kwargs): |
| 155 | def on_error(exc, intervals, retries): |
| 156 | interval = next(intervals) |
| 157 | err_msg = RECEIVER_RETRY_ERROR % \ |
| 158 | {'receiver': retry_fun, |
| 159 | 'when': humanize_seconds(interval, 'in', ' ')} |
| 160 | logger.error(err_msg) |
| 161 | return interval |
| 162 | |
| 163 | return retry_over_time(retry_fun, Exception, args, |
| 164 | kwargs, on_error) |
| 165 | |
| 166 | return _try_receiver_over_time |
| 167 | |
| 168 | if retry: |
| 169 | options['weak'] = False |
| 170 | if not dispatch_uid: |
| 171 | # if there's no dispatch_uid then we need to set the |
| 172 | # dispatch uid to the original func id so we can look |
| 173 | # it up later with the original func id |
| 174 | options['dispatch_uid'] = _make_id(fun) |
| 175 | fun = _retry_receiver(fun) |
| 176 | fun._dispatch_uid = options['dispatch_uid'] |
| 177 | |
| 178 | self._connect_signal(fun, sender, options['weak'], |
| 179 | options['dispatch_uid']) |
| 180 | return fun |
| 181 | |
| 182 | return _connect_signal |
| 183 |
nothing calls this directly
no test coverage detected