python – Multithreading in Azure Api

I need to write almost 300 different wiki page all separated by type : [Epic, Features, ….] using Azure devops python Api

And this take me many minutes when i write them one by one

So i tried to do a basic multithreading

if (multithreading):
        threads = []
        for task in task_list:
            thread = threading.Thread(target=write_one_epic, args=(task, requests_session)
            thread.start()
            threads.append(thread)
        for thread in threads:
            thread.join()

This result me in this error

The wiki page operation failed with message : TF401028: The reference 'refs/heads/wikiMaster' has already been updated by another client, so you cannot update it. Please try again.

Update, i tried with a ThreadPoolExecutor and it result me as the same error

The error is raised when i try to create a new page

wiki.create_or_update_page(content, Constant.project, Constant.wikiIdentifier, self.actual_path, None)

Read more here: Source link