laravel-cconverter icon indicating copy to clipboard operation
laravel-cconverter copied to clipboard

Disable logs totally and fetch currency

Open sukiyanen85 opened this issue 4 years ago • 4 comments

Hi,

I'm using rollbar, to track issues\warnings automatically.

My .env configuration:

CC_API_SOURCE=fixer
CC_USE_SSL=false
CC_FIXERIO_ACCESS_KEY=*******************
CC_ENABLE_LOG=false
CC_ENABLE_CACHE=true
CC_CACHE_TIMEOUT=7200

Beside I have cache timetout set to 7200 minutes the log says that the package is trying to get currency each minute, do you have any idea why this is happening?

My second question is, beside I have LOG set to false. Is still recording warning messages ( which are sent to rollbar )

image

Any idea how to solve these 2 issues?

sukiyanen85 avatar Jun 13 '20 14:06 sukiyanen85

Hi @sukiyanen85, what Laravel version are you on? I'm going to try to replicate the "no for EUR found" from fixer.io

It will try to fetch new data even if you have cache enabled if there is no successful requests (cache only starts/counts when you actually have data).

Oh and: CC_ENABLE_LOG=false/true is more of a debug log option. It will still log warnings and errors! Sorry for the confusion here, I can add some more information about that.

danielme85 avatar Jun 15 '20 17:06 danielme85

Also there should not be anything that triggers a new request, so I assume you have something in your code that expects it to be cached so every time a conversion is attempted it will try to get the EUR rates.

PS: I just did a live test trough some feature testing (so not 100% real world practical) and fixer.io seems to work there at least.

  • Could you paste me the code where you are using the currency converter?

  • Also can you confirm that your fixer.io is working and you can get a response from their API?

danielme85 avatar Jun 15 '20 17:06 danielme85

Hi @danielme85 thank you for taking the time to review.

I'm using Laravel Framework 6.18.15. Unfortunately, I had to remove this package, since I'm using rollbar free version, and there's a limit of reported events, due to the package log warnings the package was hitting the account limit :(

The package was working fine, but beside I configured 7200 minutes cache, it was called 4211 on the last 20 days.

image

I can confirm that fixer.io was getting the currency correctly.

This was the function I was using to get the currency:

function toPounds($amount)
{
    return Currency::conv('EUR', 'GBP', $amount, 1);
}

sukiyanen85 avatar Jun 15 '20 17:06 sukiyanen85

Ah I see, sorry about that. Let me check it out later and see if I find a bug

danielme85 avatar Jun 15 '20 18:06 danielme85