In manifest.json, I have following model definition:
{
    "sap.ui5": {
        "models": {
            "SalesInvoices": {
                "type": "sap.ui.model.odata.v2.ODataModel",
                "settings": {
                    "defaultOperationMode": "Server",
                    "defaultCountMode": "Request"
                },
                "dataSource": "ZAM_SALES_STATISTICS_CDS",
                "preload": true
            }
        }
    }
}
As you can see, SalesInvoices is connected to the OData service.
Now on the onInit function in the controller, I am trying to get Metadata from OData as following:
{ // Controller
    onInit: function() {
        const oPayerModel = this.getView().getModel("SalesInvoices");
        console.log(oPayerModel.getMetadata());
        setTimeout(() => {
            const oPayerModel = this.getView().getModel("SalesInvoices");
            console.log(oPayerModel.getMetadata());
        }, 600);
    },
    // ...
}
As you can see, I have to delay to get the OData instance.
setTimeout is not recommended to use in SAPUI5, how can I do it better?