|
11 | 11 |
|
12 | 12 | def transfer_results(project_id_list=None): |
13 | 13 | """Transfer results for one project after the other. |
14 | | -
|
15 | 14 | Will only trigger the transfer of results for projects |
16 | 15 | that are defined in the postgres database. |
17 | 16 | Will not transfer results for tutorials and |
@@ -57,28 +56,22 @@ def transfer_results(project_id_list=None): |
57 | 56 |
|
58 | 57 | def transfer_results_for_project(project_id, results): |
59 | 58 | """Transfer the results for a specific project. |
60 | | -
|
61 | 59 | Save results into an in-memory file. |
62 | 60 | Copy the results to postgres. |
63 | 61 | Delete results in firebase. |
64 | | -
|
65 | 62 | We are NOT using a Firebase transaction functions here anymore. |
66 | 63 | This has caused problems, in situations where a lot of mappers are |
67 | 64 | uploading results to Firebase at the same time. Basically, this is |
68 | 65 | due to the behaviour of Firebase Transaction function: |
69 | | -
|
70 | 66 | "If another client writes to this location |
71 | 67 | before the new value is successfully saved, |
72 | 68 | the update function is called again with the new current value, |
73 | 69 | and the write will be retried." |
74 | | -
|
75 | 70 | (source: https://firebase.google.com/docs/reference/admin/python/firebase_admin.db#firebase_admin.db.Reference.transaction) # noqa |
76 | | -
|
77 | 71 | Using Firebase transaction on the group level |
78 | 72 | has turned out to be too slow when using "normal" queries, |
79 | 73 | e.g. without using threading. Threading should be avoided here |
80 | 74 | as well to not run into unforeseen errors. |
81 | | -
|
82 | 75 | For more details see issue #478. |
83 | 76 | """ |
84 | 77 |
|
@@ -125,7 +118,6 @@ def transfer_results_for_project(project_id, results): |
125 | 118 |
|
126 | 119 | def delete_results_from_firebase(project_id, results): |
127 | 120 | """Delete results from Firebase using update function. |
128 | | -
|
129 | 121 | We use the update method of firebase instead of delete. |
130 | 122 | Update allows to delete items at multiple locations at the same time |
131 | 123 | and is much faster. |
|
0 commit comments