Codefactor review
This commit is contained in:
@@ -31,7 +31,6 @@ namespace Scrobbling
|
||||
class Scrobbling : public IScrobbling
|
||||
{
|
||||
public:
|
||||
|
||||
Scrobbling(Database::Db& db);
|
||||
|
||||
private:
|
||||
|
||||
@@ -29,7 +29,6 @@ namespace Scrobbling
|
||||
InternalScrobbler(Database::Db& db);
|
||||
|
||||
private:
|
||||
|
||||
void listenStarted(const Listen& listen) override;
|
||||
void listenFinished(const Listen& listen, std::chrono::seconds duration) override;
|
||||
|
||||
|
||||
@@ -316,7 +316,7 @@ namespace Scrobbling
|
||||
LOG(DEBUG) << "POST done. status = " << msg.status() << ", msg = '" << msg.body() << "'";
|
||||
if (ec)
|
||||
{
|
||||
LOG(ERROR) << "Client error: " << ec.message();
|
||||
LOG(ERROR) << "Retry " << queuedListen.retryCount << ", client error: '" << ec.message() << "'";
|
||||
// may be a network error, try again later
|
||||
if (++queuedListen.retryCount > _maxRetryCount)
|
||||
_sendQueue.pop_front();
|
||||
@@ -363,7 +363,7 @@ namespace Scrobbling
|
||||
{
|
||||
assert(_state == State::Idle);
|
||||
|
||||
const std::chrono::seconds duration {requestedDuration.count() > 0 ? requestedDuration : std::chrono::seconds {1}};
|
||||
const std::chrono::seconds duration {clamp(requestedDuration, _minRetryWaitDuration, _maxRetryWaitDuration)};
|
||||
LOG(DEBUG) << "Throttling for " << duration.count() << " seconds";
|
||||
|
||||
_ioService.schedule(duration, [this]
|
||||
|
||||
@@ -74,6 +74,8 @@ namespace Scrobbling
|
||||
const std::string _apiEndpoint;
|
||||
const std::size_t _maxRetryCount {2};
|
||||
const std::chrono::seconds _defaultRetryWaitDuration {30};
|
||||
const std::chrono::seconds _minRetryWaitDuration {1};
|
||||
const std::chrono::seconds _maxRetryWaitDuration {300};
|
||||
|
||||
Database::Db& _db;
|
||||
Wt::WIOService _ioService;
|
||||
|
||||
@@ -37,7 +37,6 @@ namespace UserInterface
|
||||
Wt::Signal<LmsApplication&> applicationUnregistered;
|
||||
|
||||
private:
|
||||
|
||||
friend class LmsApplication;
|
||||
|
||||
void registerApplication(LmsApplication& application);
|
||||
|
||||
@@ -114,15 +114,6 @@ class MediaPlayer : public Wt::WTemplate
|
||||
Wt::JSignal<> playbackEnded;
|
||||
|
||||
private:
|
||||
|
||||
enum class State
|
||||
{
|
||||
Playing,
|
||||
Stopped,
|
||||
};
|
||||
std::chrono::steady_clock::time_point _lastStateTimePoint;
|
||||
State _state {State::Stopped};
|
||||
|
||||
std::unique_ptr<AudioFileResource> _audioFileResource;
|
||||
std::unique_ptr<AudioTranscodeResource> _audioTranscodeResource;
|
||||
|
||||
|
||||
@@ -308,7 +308,6 @@ class SettingsModel : public Wt::WFormModel
|
||||
|
||||
void initializeModels()
|
||||
{
|
||||
|
||||
_transcodeModeModel = std::make_shared<TranscodeModeModel>();
|
||||
_transcodeModeModel->add(Wt::WString::tr("Lms.Settings.transcode-mode.always"), MediaPlayer::Settings::Transcode::Mode::Always);
|
||||
_transcodeModeModel->add(Wt::WString::tr("Lms.Settings.transcode-mode.never"), MediaPlayer::Settings::Transcode::Mode::Never);
|
||||
|
||||
@@ -2098,7 +2098,6 @@ testDatabaseEmpty(Session& session)
|
||||
|
||||
int main()
|
||||
{
|
||||
|
||||
try
|
||||
{
|
||||
// log to stdout
|
||||
|
||||
Reference in New Issue
Block a user