Forums

Is this considered multi-threading?

Hi All,

I'm building a web app and recently ran into an issue. When a user visits my app for the fist time, I get some information from them via form and use it to create a file to upload to amazon s3. I realize now I need to make the upload to s3 a background process since it is multi-threading. However, will the latter part of my flow also be considered multi threading: When a repeat user accesses my app, their request contains an access token parameter which I need to use in real time to look up their file on s3 and pull the file data into memory/session since I need that info to complete their request. Is this considered multi-threading? Would like to know before I begin writing the code. Thank you for any help.

I'm not entirely sure what you mean by "considered". Multi-threading is simple: If you start a thread, that's multi-threading. If you don't then it's not.

sorry for my question being unclear - I am still new(ish) to programming and this is the first I've heard about the concept of threads. I have updated my code to save user-provided information in a file in the 'mysite' directory. Subsequent requests by existing users will contain a parameter I use to lookup their corresponding file and I'm attempting to read the file contents in real time as I need the information the file contains to complete the request. I've been troubleshooting this using print statements and have been getting threading errors inconsistently. Is this something that is supported on PA or is this still not enough information to go on.

if you are just writing to a file and later on reading from a file, that is fine. in fact, just do the open('file_path', 'w') and write it directly in your code. that is not multithreading, as your code will block briefly as it opens and writes. multithreading is say if you spin off a separate process that does a bunch of number crunching on the side.