mirror of
				https://github.com/open-metadata/OpenMetadata.git
				synced 2025-10-31 02:29:03 +00:00 
			
		
		
		
	Wait for Indexing Job to complete (#14986)
This commit is contained in:
		
							parent
							
								
									306adfcca0
								
							
						
					
					
						commit
						8f94e54395
					
				| @ -250,9 +250,11 @@ public class SearchIndexApp extends AbstractNativeApplication { | |||||||
| 
 | 
 | ||||||
|   private void sendUpdates() { |   private void sendUpdates() { | ||||||
|     try { |     try { | ||||||
|  |       if (WebSocketManager.getInstance() != null) { | ||||||
|         WebSocketManager.getInstance() |         WebSocketManager.getInstance() | ||||||
|             .broadCastMessageToAll( |             .broadCastMessageToAll( | ||||||
|                 WebSocketManager.JOB_STATUS_BROADCAST_CHANNEL, JsonUtils.pojoToJson(jobData)); |                 WebSocketManager.JOB_STATUS_BROADCAST_CHANNEL, JsonUtils.pojoToJson(jobData)); | ||||||
|  |       } | ||||||
|     } catch (Exception ex) { |     } catch (Exception ex) { | ||||||
|       LOG.error("Failed to send updated stats with WebSocket", ex); |       LOG.error("Failed to send updated stats with WebSocket", ex); | ||||||
|     } |     } | ||||||
|  | |||||||
| @ -6,6 +6,7 @@ import static org.quartz.impl.matchers.GroupMatcher.jobGroupEquals; | |||||||
| import java.util.UUID; | import java.util.UUID; | ||||||
| import java.util.concurrent.ConcurrentHashMap; | import java.util.concurrent.ConcurrentHashMap; | ||||||
| import java.util.concurrent.ConcurrentMap; | import java.util.concurrent.ConcurrentMap; | ||||||
|  | import lombok.Getter; | ||||||
| import lombok.extern.slf4j.Slf4j; | import lombok.extern.slf4j.Slf4j; | ||||||
| import org.openmetadata.common.utils.CommonUtil; | import org.openmetadata.common.utils.CommonUtil; | ||||||
| import org.openmetadata.schema.AppRuntime; | import org.openmetadata.schema.AppRuntime; | ||||||
| @ -37,7 +38,7 @@ public class AppScheduler { | |||||||
|   public static final String SEARCH_CLIENT_KEY = "searchClientKey"; |   public static final String SEARCH_CLIENT_KEY = "searchClientKey"; | ||||||
|   private static AppScheduler instance; |   private static AppScheduler instance; | ||||||
|   private static volatile boolean initialized = false; |   private static volatile boolean initialized = false; | ||||||
|   private final Scheduler scheduler; |   @Getter private final Scheduler scheduler; | ||||||
|   private static final ConcurrentHashMap<UUID, JobDetail> appJobsKeyMap = new ConcurrentHashMap<>(); |   private static final ConcurrentHashMap<UUID, JobDetail> appJobsKeyMap = new ConcurrentHashMap<>(); | ||||||
|   private final CollectionDAO collectionDAO; |   private final CollectionDAO collectionDAO; | ||||||
|   private final SearchRepository searchClient; |   private final SearchRepository searchClient; | ||||||
|  | |||||||
| @ -100,6 +100,7 @@ public class TeamRepository extends EntityRepository<Team> { | |||||||
|         TEAM_UPDATE_FIELDS); |         TEAM_UPDATE_FIELDS); | ||||||
|     this.quoteFqn = true; |     this.quoteFqn = true; | ||||||
|     supportsSearch = true; |     supportsSearch = true; | ||||||
|  |     initOrganization(); | ||||||
|   } |   } | ||||||
| 
 | 
 | ||||||
|   @Override |   @Override | ||||||
|  | |||||||
| @ -252,6 +252,9 @@ public class OpenMetadataOperations implements Callable<Integer> { | |||||||
|                           config.getElasticSearchConfiguration().getSearchIndexMappingLanguage())) |                           config.getElasticSearchConfiguration().getSearchIndexMappingLanguage())) | ||||||
|               .withRuntime(new ScheduledExecutionContext().withEnabled(true)); |               .withRuntime(new ScheduledExecutionContext().withEnabled(true)); | ||||||
|       AppScheduler.getInstance().triggerOnDemandApplication(searchIndexApp); |       AppScheduler.getInstance().triggerOnDemandApplication(searchIndexApp); | ||||||
|  |       do { | ||||||
|  |         Thread.sleep(3000l); | ||||||
|  |       } while (!AppScheduler.getInstance().getScheduler().getCurrentlyExecutingJobs().isEmpty()); | ||||||
|       return 0; |       return 0; | ||||||
|     } catch (Exception e) { |     } catch (Exception e) { | ||||||
|       LOG.error("Failed to reindex due to ", e); |       LOG.error("Failed to reindex due to ", e); | ||||||
|  | |||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user
	 Mohit Yadav
						Mohit Yadav