This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
async function printReservation() { | |
const companyId = '-Kl2_DOjdmBh4Rlj58C1'; | |
const branchId = '-Kl2_DOjdmBh4Rlj58C2'; | |
const db = getCachedAdminDB(companyId); | |
const tableData = (await db.ref(`branchTables/${companyId}/${branchId}`).once('value')).val(); | |
const tableMap = {}; | |
for (const [sectionId, section] of Object.entries(tableData)) { | |
for (const [tableId, table] of Object.entries(section.tables)) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
let asyncRequest = NSAsynchronousFetchRequest(fetchRequest: request) { fetchResult in | |
// this may or may not right in the same thread as the context thread | |
// except when the context is main thread, this will always run in main thread | |
// TODO: can i access NSManagedObject safely if this is not the same thread? | |
print("ttt: blk thread: \(Thread.current)") | |
Thread.sleep(forTimeInterval: 100) | |
guard let dataResult = fetchResult.finalResult else { | |
return | |
} |
OlderNewer