(progress)
| 745 | # to every 2 seconds (and always record the 100% progress) |
| 746 | last_update = 0 |
| 747 | def callback(progress): |
| 748 | nonlocal last_update |
| 749 | |
| 750 | time_has_elapsed = time.time() - last_update >= 2 |
| 751 | if time_has_elapsed: |
| 752 | testWatch.manual_log_call("Task.process.callback") |
| 753 | self.check_if_canceled() |
| 754 | Task.objects.filter(pk=self.id).update(upload_progress=float(progress) / 100.0) |
| 755 | last_update = time.time() |
| 756 | |
| 757 | # This takes a while |
| 758 | try: |
no test coverage detected