- Introduced constants for configuration settings such as generation interval, maximum duration, and sleep duration. - Updated the `perform` method to utilize these constants for better readability and maintainability. - Refactored the `perform` method in `GenerateWeatherArtWorker` to improve flow and error handling by creating separate methods for fetching weather data, generating prompts, images, and handling database transactions. - Cleaned up city seeding data by removing unnecessary fields while maintaining required functionality. These changes improve the overall readability of the code and make it easier to adjust the behavior of the workers in the future without digging through the logic.
14 lines
231 B
Ruby
14 lines
231 B
Ruby
brazil = Country.find_by code: 'BR'
|
|
|
|
City.create!([
|
|
{
|
|
name: 'Rio de Janeiro',
|
|
latitude: -22.9068,
|
|
longitude: -43.1729,
|
|
country: brazil,
|
|
timezone: 'America/Sao_Paulo',
|
|
active: true,
|
|
priority: 80
|
|
}
|
|
])
|