Skip to content

Avoid unnecessary async functions? #3

@oyooyo

Description

@oyooyo

When looking at the source code, I came to realize that there are some functions that seem to be unnecessarily marked as being async.

The debug function in file dcc.js for example has the following implementation

export async function debug(uri) {
  return await decodeCbor(await unpack(uri));
}

So it is probably being marked as async because it uses and awaits the functions decodeCbor and unpack, which are both marked as being async.
But it seems to me that these two functions don't need to be async either; there is no await statement in the unpack function, and the only await statements in decodeCbor are when the decodeCbor function itself is being called recursively, so async/await should be unnecessary here as well.

I haven't looked at the rest of the code, so there might be more functions that are ultimately unnecessarily marked as being async.

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