<commit_before>import UIKit
import Faro
import Stella
import Foundation

class PostViewController: UIViewController {
    @IBOutlet var label: UILabel!

	/// !! It is important to retain the service until you have a result.

    let configuration = Configuration(baseURL: "http://jsonplaceholder.typicode.com")
    let failingService = Service(call: Call(path: "bullshit"), configuration: configuration)
	let service = Service(call: Call(path: "posts"), configuration: configuration)

    override func viewDidLoad() {
        super.viewDidLoad()

        service.perform([Post].self) {[weak self] (resultFunction) in
            DispatchQueue.main.async {
                do {
                    let posts = try resultFunction()
                    self?.label.text = "Performed call for posts"
                    printAction("Service \(posts.map {"\($0.uuid): \($0.title ?? "")"}.reduce("") {"\($0)\n\($1)"})")
                } catch {
                    printError(error)
                }
            }
        }

		// Test service queue

        let serviceQueue = ServiceQueue(deprecatedServiceQueue: ExampleDeprecatedServiceQueue { (failedTaks) in
			printAction("🎉 queued call finished with failedTasks \(String(describing: failedTaks)))")
        })

		let call = Call(path: "posts")
		serviceQueue.collection(call: call, autoStart: true) { (resultFunction: () throws -> [Post]) in
			let posts = try? resultFunction()
			printAction("ServiceQueue Task 1 finished  \(posts?.count ?? -1)")
		}

		serviceQueue.collection(call: call, autoStart: true) { (resultFunction: () throws -> [Post]) in
			let posts = try? resultFunction()
			printAction("ServiceQueue Task 2 finished  \(posts?.count ?? -1)")
		}

		serviceQueue.collection(call: call, autoStart: true) { (resultFunction: () throws -> [Post]) in
			let posts = try? resultFunction()
			printAction("ServiceQueue Task 3 finished  \(posts?.count ?? -1)")
		}

        serviceQueue.resumeAll()

		// Test failure

		failingService.single {  _ in
			// should have printed failure
		}

		failingService.collection {  _ in
			// should have printed failure
		}
    }

}<commit_msg>fix postViewController<commit_after>import UIKit
import Faro
import Stella
import Foundation

class PostViewController: UIViewController {
    @IBOutlet var label: UILabel!

	/// !! It is important to retain the service until you have a result.

    let failingService = Service(call: Call(path: "bullshit"),
                                 configuration: Configuration(baseURL: "http://jsonplaceholder.typicode.com"))
	let service = Service(call: Call(path: "posts"),
                          configuration: Configuration(baseURL: "http://jsonplaceholder.typicode.com"))

    override func viewDidLoad() {
        super.viewDidLoad()

        service.perform([Post].self) {[weak self] (resultFunction) in
            DispatchQueue.main.async {
                do {
                    let posts = try resultFunction()
                    self?.label.text = "Performed call for posts"
                    printAction("Service \(posts.map {"\($0.uuid): \($0.title ?? "")"}.reduce("") {"\($0)\n\($1)"})")
                } catch {
                    printError(error)
                }
            }
        }

		// Test service queue

        let serviceQueue = ServiceQueue(Configuration(baseURL: "http://jsonplaceholder.typicode.com")) {
			printAction("🎉 queued call finished with failedTasks \(String(describing: $0)))")
        }

		let call = Call(path: "posts")
        serviceQueue.perform([Post].self, call: call, complete: { (resultFunction) in
            let posts = try? resultFunction()
            printAction("ServiceQueue Task 1 finished  \(posts?.count ?? -1)")
        })

        serviceQueue.perform([Post].self, call: call, complete: { (resultFunction) in
            let posts = try? resultFunction()
            printAction("ServiceQueue Task 2 finished  \(posts?.count ?? -1)")
        })

        serviceQueue.perform([Post].self, call: call, complete: { (resultFunction) in
            let posts = try? resultFunction()
            printAction("ServiceQueue Task 3 finished  \(posts?.count ?? -1)")
        })

        serviceQueue.resumeAll()

		// Test failure

        failingService.perform(Post.self) {  _ in
            // should have printed failure
        }
    }

}
{'fraction_non_alphanumeric': 0.1269257300528857, 'fraction_numerical': 0.004828696252011957, 'mean_word_length': 2.4578696343402227, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 6, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 1, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2398833', 'n_tokens_mistral': 1228, 'n_tokens_neox': 1135, 'n_words': 311}