cria cronjob com horario randomico para atualizar indices do solr#3637
Open
joaohortsenado wants to merge 2 commits into3.1.xfrom
Open
cria cronjob com horario randomico para atualizar indices do solr#3637joaohortsenado wants to merge 2 commits into3.1.xfrom
joaohortsenado wants to merge 2 commits into3.1.xfrom
Conversation
edwardoliveira
requested changes
Mar 26, 2023
Contributor
edwardoliveira
left a comment
There was a problem hiding this comment.
Tem que mudar a interação com Solr. Eu indiquei no review como a gente faz atualmente.
docker/solr_cli.py
Outdated
Comment on lines
351
to
358
|
|
||
| if args.rebuild_index: | ||
| print("Rebuilding index of '%s' collection..." % collection) | ||
| client.rebuild_index(collection) | ||
|
|
||
| if args.update_index: | ||
| print("Updating index of '%s' collection..." % collection) | ||
| client.update_index_last_day(collection) |
Contributor
There was a problem hiding this comment.
As chamadas tem que ser feitas como tá sendo feito na linha 350. ;)
Comment on lines
+88
to
+96
|
|
||
| RANDOM_MINUTE_MIN=0 | ||
| RANDOM_MINUTE_MAX=60 | ||
| RANDOM_HOUR_MIN=0 | ||
| RANDOM_HOUR_MAX=3 | ||
|
|
||
| # Generate a random minute within the interval | ||
| RANDOM_MINUTE=$((RANDOM % ($RANDOM_MINUTE_MAX-$RANDOM_MINUTE_MIN+1) + $RANDOM_MINUTE_MIN)) | ||
| RANDOM_HOUR=$((RANDOM % ($RANDOM_HOUR_MAX-$RANDOM_HOUR_MIN+1) + $RANDOM_HOUR_MIN)) |
Contributor
There was a problem hiding this comment.
Aqui eu estava pensando no seguinte esquema: ter uma hora base a noite e variar a hora e minuto a partir do qual a atualização do índice vai ocorrer todo dia. Isso pode ser resolvido conforme o script em bash abaixo:
BASE_HOUR=20
random_time() {
RANDOM_HOUR=$((RANDOM % 4))
RANDOM_MIN=$(printf "%02d" $((RANDOM % 60)))
RANDOM_TIME=$((BASE_HOUR + RANDOM_HOUR))":"$RANDOM_MIN
echo $RANDOM_TIME
}
# gera sequencia de 10 horários aleatórios para teste
for i in {1..10}; do
echo `random_time`
done
Neste caso, a partir das 20h ele vai gerar um horário aleatório pro cronjob rodar. Pode ser criada duas funções uma pra retornar a hora e houra pra retornar o minuto.
44c7429 to
bda00ac
Compare
f92c461 to
3faba84
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Descrição
cria cronjob para atualizar indices do solr
Motivação e Contexto
resolver problema com novos arquivos e dados que nao aparecem nas pesquisas
Como Isso Foi Testado?
localmente
Tipos de Mudanças
Checklist: