parameters: (self, updates, cursor)
docstring: We want regular node queries to be able to tell whether a particular
          cache segment is valid. Therefore we queue a new dirty cell entry and
          send another notify(). Queue entries are then processed by a set of
          different workers. To do this, get all the enabled grid caches for each
          project and then, for each notification compute the intersected grid
          indices with each grid, update existing grids and create missing ones.
docstring_summary: We want regular node queries to be able to tell whether a particular
          cache segment is valid. Therefore we queue a new dirty cell entry and
          send another notify(). Queue entries are then processed by a set of
          different workers. To do this, get all the enabled grid caches for each
          project and then, for each notification compute the intersected grid
          indices with each grid, update existing grids and create missing ones.
docstring_tokens: We want regular node queries to be able to tell whether a particular cache segment is valid . Therefore we queue a new dirty cell entry and send another notify () . Queue entries are then processed by a set of different workers . To do this get all the enabled grid caches for each project and then for each notification compute the intersected grid indices with each grid update existing grids and create missing ones .
function: def update(self, updates, cursor):
          """ We want regular node queries to be able to tell whether a particular
          cache segment is valid. Therefore we queue a new dirty cell entry and
          send another notify(). Queue entries are then processed by a set of
          different workers. To do this, get all the enabled grid caches for each
          project and then, for each notification compute the intersected grid
          indices with each grid, update existing grids and create missing ones.
          """
          # Batch of grids to update during one run
          grid_coords_to_update:Dict = {}
          for update in updates:
              self.updatesReceived += 1
              self.get_intersected_grid_cell_ids(update,
                      cursor, create=True, grid_coords_to_update=grid_coords_to_update)
  
          dirty_rows:Set = set()
          for grid_id, coords in grid_coords_to_update.items():
              for c in coords:
                  self.cellsMarkedDirty += 1
                  key = f"({grid_id},{c[0]},{c[1]},{c[2]})"
                  if key not in dirty_rows:
                      dirty_rows.add(key)
  
          if dirty_rows:
              # Mark cells as dirty
              cursor.execute(f"""
                  INSERT INTO dirty_node_grid_cache_cell (grid_id, x_index, y_index, z_index)
                  VALUES {','.join(dirty_rows)}
                  ON CONFLICT (grid_id, x_index, y_index, z_index)
                  DO UPDATE SET invalidation_time = EXCLUDED.invalidation_time
              """)
  
              logger.debug(f'Marked {len(dirty_rows)} grid cells as dirty and queued update')
function_tokens: def update ( self , updates , cursor ) : # Batch of grids to update during one run grid_coords_to_update : Dict = { } for update in updates : self . updatesReceived += 1 self . get_intersected_grid_cell_ids ( update , cursor , create = True , grid_coords_to_update = grid_coords_to_update ) dirty_rows : Set = set ( ) for grid_id , coords in grid_coords_to_update . items ( ) : for c in coords : self . cellsMarkedDirty += 1 key = f"({grid_id},{c[0]},{c[1]},{c[2]})" if key not in dirty_rows : dirty_rows . add ( key ) if dirty_rows : # Mark cells as dirty cursor . execute ( f"""
                  INSERT INTO dirty_node_grid_cache_cell (grid_id, x_index, y_index, z_index)
                  VALUES {','.join(dirty_rows)}
                  ON CONFLICT (grid_id, x_index, y_index, z_index)
                  DO UPDATE SET invalidation_time = EXCLUDED.invalidation_time
              """ ) logger . debug ( f'Marked {len(dirty_rows)} grid cells as dirty and queued update' )