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