Is there a problem with a simultaneous database query with two queries?

I have a database where I store information (right?) And I am using the DB to add a set of arrays during the viewDidLoad()

original ViewController

. I would like to trigger the request / add every time the page is loaded, so it's in viewDidLoad()

It works great. Usually:

override func viewDidLoad() {
    super.viewDidLoad()
    let vDLQuery = PFQuery(className: "classA")
    vDLQuery.findObjectsInBackground { (objects, error) in
        for object in objects?{
            //append a set of arrays
        }
    }
}

      

This works great. My question is, can I query the same DB / class in didFinishLaunching()

if there is no problem? I would like to add a different set of arrays only on the first launch of the application (and not during each load of the first view as in the first request), but this request is fetched from the same DB / class:

func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplicationLaunchOptionsKey: Any]?) -> Bool {
    let query = PFQuery(className: "classA")
    query.findObjectsInBackground { (objects, error) in
       for object in objects{
          //append a different set of arrays
       }
    }
}

      

Since the viewController with the above vDLQuery

is the first controller, these two requests will probably be executed at the same time. My question is, will this lead to a problem as they are adding different arrays at the same time from the same database class?

+3


source to share





All Articles