From c06cf4ba3b28fad83617d24898760b213adb8ffc Mon Sep 17 00:00:00 2001 From: jMyles Date: Sun, 24 Mar 2019 15:23:04 +0100 Subject: [PATCH] OK, start with a cache argument in generate_work_orders. --- nucypher/characters/lawful.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/nucypher/characters/lawful.py b/nucypher/characters/lawful.py index 01b34bdcd..aa8c83aa6 100644 --- a/nucypher/characters/lawful.py +++ b/nucypher/characters/lawful.py @@ -630,7 +630,7 @@ class Bob(Character): return treasure_map - def generate_work_orders(self, map_id, *capsules, num_ursulas=None): + def generate_work_orders(self, map_id, *capsules, num_ursulas=None, cache=False): from nucypher.policy.models import WorkOrder # Prevent circular import try: @@ -659,9 +659,9 @@ class Bob(Character): work_order = WorkOrder.construct_by_bob( arrangement_id, capsules_to_include, ursula, self) generated_work_orders[node_id] = work_order - - # TODO: Fix this. It's always using the last capsule, via leaky-loop - self._saved_work_orders[node_id][capsule] = work_order + # TODO: Fix this. It's always taking the last capsule + if cache: + self._saved_work_orders[node_id][capsule] = work_order if num_ursulas == len(generated_work_orders): break