songtianlun
b05cf10017
- 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.
23 lines
392 B
Ruby
23 lines
392 B
Ruby
russia = Country.find_by code: 'RU'
|
|
|
|
City.create!([
|
|
{
|
|
name: 'Moscow',
|
|
latitude: 55.7558,
|
|
longitude: 37.6173,
|
|
country: russia,
|
|
timezone: 'Europe/Moscow',
|
|
active: true,
|
|
priority: 100
|
|
},
|
|
{
|
|
name: 'Sankt Petersburg',
|
|
latitude: 59.9311,
|
|
longitude: 30.3609,
|
|
country: russia,
|
|
timezone: 'Europe/Moscow',
|
|
active: true,
|
|
priority: 100
|
|
}
|
|
])
|