@@ -147,49 +147,12 @@ def merge_docs(self, master, dup):
147147 return master
148148
149149 def save (self , docs , master , duplicates ):
150- # There is a bug (#89) due to which old revisions of the docs are being sent to
151- # save. Collecting all the possible information to detect the problem and
152- # saving it in datastore. See that data here:
153- # https://openlibrary.org/admin/inspect/store?type=merge-authors-debug&name=bad_merge&value=true
154- mc = self ._get_memcache ()
155- debug_doc = {
156- 'type' : 'merge-authors-debug' ,
157- 'memcache' : mc
158- and {
159- k : json .loads (v )
160- for k , v in mc .get_multi ([doc ['key' ] for doc in docs ]).items ()
161- },
162- 'docs' : docs ,
163- }
164-
165- result = web .ctx .site .save_many (
150+ return web .ctx .site .save_many (
166151 docs ,
167152 comment = 'merge authors' ,
168153 action = "merge-authors" ,
169154 data = {"master" : master , "duplicates" : list (duplicates )},
170155 )
171- before_revs = {doc ['key' ]: doc .get ('revision' ) for doc in docs }
172- after_revs = {row ['key' ]: row ['revision' ] for row in result }
173-
174- # Bad merges are happening when we are getting non-recent docs. That can be
175- # identified by checking difference in the revision numbers before/after save
176- bad_merge = any (
177- after_revs [key ] > before_revs [key ] + 1
178- for key in after_revs
179- if before_revs [key ] is not None
180- )
181-
182- debug_doc ['bad_merge' ] = str (bad_merge ).lower ()
183- debug_doc ['result' ] = result
184- key = 'merge_authors/%d' % web .ctx .site .seq .next_value ('merge-authors-debug' )
185- web .ctx .site .store [key ] = debug_doc
186-
187- return result
188-
189- def _get_memcache (self ):
190- from openlibrary .plugins .openlibrary import connection
191-
192- return connection ._memcache
193156
194157
195158re_whitespace = re .compile (r'\s+' )
0 commit comments