-
Notifications
You must be signed in to change notification settings - Fork 69
Open
Description
I'm getting an error when querying properties of recently created lists: After I create a list, I then query for the list of lists (CreateSend::Client#lists) and the recently-created list is missing most of the time.
This rake task consistently exhibits the issue for me:
require 'createsend'
namespace :campaign_monitor do
task :demo do
auth = {api_key: API_KEY}
client_id = CreateSend::CreateSend.new(auth).clients.tap do |cs|
raise if cs.size != 1
end.first['ClientID']
client = CreateSend::Client.new(auth, client_id)
p [:available_lists, client.lists.map(&:Name)]
# (empty list to start)
20.times do |i|
puts "Creating list#{i}"
list_id = CreateSend::List.create(auth, client_id, "list#{i}", "https://localhost", false, "https://localhost")
sleep 10
p [:available_lists, client.lists.map(&:Name)]
# Even after 10 seconds, still missing....
puts
end
end
end
Output:
[:available_lists, []]
Creating list0
[:available_lists, []]
Creating list1
[:available_lists, []]
Creating list2
[:available_lists, ["list0", "list1", "list2"]]
Creating list3
[:available_lists, ["list0", "list1", "list2"]]
Creating list4
[:available_lists, ["list0", "list1", "list2"]]
Creating list5
[:available_lists, ["list0", "list1", "list2", "list3", "list4", "list5"]]
Creating list6
[:available_lists, ["list0", "list1", "list2", "list3", "list4", "list5"]]
Creating list7
[:available_lists, ["list0", "list1", "list2", "list3", "list4", "list5"]]
.... (etc, same 30-second delay for the rest) ...
I can, however, grab the list ID that comes back from the CreateSend::List.create call, and use it to delete the list from the server (presumably I could do other things with it via the API).
This behavior definitely feels unintuitive, so some docs about what my expectations should be would be nice at least.
chrismaddocks, snkshukla and utkarshrai003
Metadata
Metadata
Assignees
Labels
No labels