@@ -26,6 +26,7 @@ import org.slf4j.LoggerFactory
2626import org.springframework.beans.factory.annotation.Value
2727import org.springframework.stereotype.Service
2828
29+ @SuppressWarnings(" TooManyFunctions" )
2930@Service
3031class WebhookEventService (
3132 private val webSocketService : WebSocketService ,
@@ -228,17 +229,30 @@ class WebhookEventService(
228229 }
229230 }
230231
231- private fun processRepository (installation : Installation , repositoryAdded : InstallationRepositoriesRepository , installationToken : String ) {
232+ private fun processRepository (
233+ installation : Installation ,
234+ repositoryAdded : InstallationRepositoriesRepository ,
235+ installationToken : String
236+ ) {
232237 logger.info(" Fetching repository details for: ${repositoryAdded.fullName} " )
233- gitHubGraphQLService.getRepository(installation.account.login, repositoryAdded.name, installationToken)?.let { repository ->
234- if (repository.archived) {
235- logger.info(" Repository ${repository.fullName} is archived, skipping." )
236- return
237- }
238- logger.info(" Sending repository details for: ${repository.fullName} " )
239- webSocketService.sendMessage(" events/repository" , repository)
240- fetchAndSendManifestFiles(installation, repository)
238+ val repository = rateLimitHandler.executeWithRateLimitHandler(RateLimitType .GRAPHQL ) {
239+ gitHubGraphQLService.getRepository(
240+ installation.account.login,
241+ repositoryAdded.name,
242+ installationToken
243+ )
244+ }
245+ if (repository == null ) {
246+ logger.error(" Failed to fetch repository details for: ${repositoryAdded.fullName} " )
247+ return
248+ }
249+ if (repository.archived) {
250+ logger.info(" Repository ${repository.fullName} is archived, skipping." )
251+ return
241252 }
253+ logger.info(" Sending repository details for: ${repository.fullName} " )
254+ webSocketService.sendMessage(" events/repository" , repository)
255+ fetchAndSendManifestFiles(installation, repository)
242256 }
243257
244258 private fun fetchAndSendManifestFiles (installation : Installation , repositoryAdded : RepositoryDto ) {
0 commit comments