Fix incorrect free. (#9)

This commit is contained in:
Robert Nishihara
2016-10-07 12:31:57 -07:00
committed by Philipp Moritz
parent 18934c3a45
commit e9a336a344
2 changed files with 11 additions and 2 deletions
-1
View File
@@ -74,7 +74,6 @@ void handle_submit_task(local_scheduler_state *s, task_spec *task) {
(uint8_t *)task);
/* Remove the available worker from the queue and free the struct. */
utarray_pop_back(s->available_worker_queue);
free(worker);
} else {
/* Add the task to the task queue. This passes ownership of the task queue.
* And the task will be freed when it is assigned to a worker. */
+11 -1
View File
@@ -43,7 +43,7 @@ class TestPhotonClient(unittest.TestCase):
os._exit(self.p2.returncode)
else:
self.p2.kill()
def test_submit_and_get_task(self):
# TODO(rkn): This should be a FunctionID.
@@ -94,6 +94,16 @@ class TestPhotonClient(unittest.TestCase):
else:
self.assertEqual(args[i], retrieved_args[i])
# Submit all of the tasks.
for args in args_list:
for num_return_vals in [0, 1, 2, 3, 5, 10, 100]:
task = photon.Task(function_id, args, num_return_vals)
self.photon_client.submit(task)
# Get all of the tasks.
for args in args_list:
for num_return_vals in [0, 1, 2, 3, 5, 10, 100]:
new_task = self.photon_client.get_task()
if __name__ == "__main__":
if len(sys.argv) > 1:
# pop the argument so we don't mess with unittest's own argument parser