You can, but typically, I don't like passing "complex" objects into background jobs as parameters. I know that Global Id is just a string and that would work, but it always feels better to be a bit more explicit with what I'm passing instead of passing an Object which gets converted into a String. So, I think it may be more of a personal choice/style.
As a suggestion to optimize this further, I would use "upsert_all" to insert all countries with one sql query and delegate to another job the download of the flags. The one job per country seems like a giant N+1 query to me. Obviously, there is no need to optimize so much if theses imports happen only from time to time.
As a suggestion to optimize this further, I would use "upsert_all" to insert all countries with one sql query and delegate to another job the download of the flags. The one job per country seems like a giant N+1 query to me.
Obviously, there is no need to optimize so much if theses imports happen only from time to time.