Skip to content

Conversation

@robertatakenaka
Copy link
Member

Pull Request: Corrigir retorno da task task_harvest_and_load_issue

Descrição

Corrige o retorno da task task_harvest_and_load_issue para retornar o ID do issue em vez do objeto completo, e remove o retorno implícito None no caso de falha.

Alterações

  • Retorna issue.id em vez do objeto issue quando o carregamento é bem-sucedido
  • Remove o return issue que estava fora do bloco condicional, evitando retorno desnecessário

Motivação

O retorno do ID em vez do objeto completo é mais apropriado para tasks Celery, pois:

  • IDs são serializáveis de forma trivial
  • Evita problemas de serialização de objetos Django
  • Facilita o encadeamento de tasks que precisam apenas da referência ao registro

Tipo de mudança

  • Bug fix (correção que não quebra funcionalidade existente)
  • Nova feature
  • Breaking change

Checklist

  • Testes passando
  • Código segue os padrões do projeto

Copilot AI review requested due to automatic review settings January 20, 2026 19:17
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR fixes the return value of the Celery task task_harvest_and_load_issue to return a serializable ID instead of a Django model object, addressing potential serialization issues.

Changes:

  • Returns issue.id instead of the full issue object when loading succeeds
  • Removes the unreachable return issue statement that was outside the conditional block

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

return issue.id
else:
logger.warning(f"Failed to load issue {code} from {url}")

Copy link

Copilot AI Jan 20, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The else branch should explicitly return None to maintain consistent return behavior. When the issue fails to load, the function currently has no return statement, which implicitly returns None but makes the control flow less clear. Consider adding return None after the warning log.

Suggested change
return None

Copilot uses AI. Check for mistakes.
@robertatakenaka robertatakenaka merged commit 56c96a2 into scieloorg:main Jan 20, 2026
9 of 11 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant