Skip to content
This repository was archived by the owner on Jun 27, 2023. It is now read-only.
This repository was archived by the owner on Jun 27, 2023. It is now read-only.

Is Future.map(on: worker) intentionally synchronous? #167

@bmhatfield

Description

@bmhatfield

When working with Vapor, I recently was surprised to learn that Future.map was a synchronous method that returns a future. I had been under the mistaken impression that it executed the closure on the event loop.

Compare: https://github.com/vapor/core/blob/master/Sources/Async/Future%2BGlobal.swift#L11-L21

with .submit: https://github.com/apple/swift-nio/blob/ae13d135f79e7b60281f9bf4c1cf1b3341a7339f/Sources/NIO/EventLoop.swift#L268-L280

Just checking that this wasn't an oversight, because the two methods appear to be very close in implementation.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions