Skip to content

Async filter function (to interface with database) #80

@lorentzkim

Description

@lorentzkim

This is from tracker's point of view.

I am attempting to extend the usage of filter function by e.g. using a database to query whether the torrent has valid infoHash or not, as well as any other params that needs to be checked.

Database queries, as being network requests, are async in nature, and they don't return a value but a callback to do further processing.

Filter function requires a return value (a boolean).

Is there any way that you can think of to easily do both? As I can see it, there's no way to do this cleanly. Using async module or whatnot isn't going to cut it as it's not the order of the processing, but rather inability to return a value from a callback to original caller (which doesn't make sense anyway).

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions