Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
M
mpd
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Иван Мажукин
mpd
Commits
d1cc7377
Commit
d1cc7377
authored
Feb 16, 2020
by
Max Kellermann
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Instance: flush input cache on SIGHUP
parent
29d05cdb
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
24 additions
and
4 deletions
+24
-4
user.rst
doc/user.rst
+8
-1
Instance.cxx
src/Instance.cxx
+7
-0
Instance.hxx
src/Instance.hxx
+2
-0
SignalHandlers.cxx
src/unix/SignalHandlers.cxx
+7
-3
No files found.
doc/user.rst
View file @
d1cc7377
...
...
@@ -295,6 +295,8 @@ The following table lists the input options valid for all plugins:
More information can be found in the :ref:`input_plugins` reference.
.. _input_cache:
Configuring the Input Cache
^^^^^^^^^^^^^^^^^^^^^^^^^^^
...
...
@@ -327,6 +329,9 @@ configuration file:
This allocates a cache of 1 GB. If the cache grows larger than that,
older files will be evicted.
You flush the cache at any time by sending ``SIGHUP`` to the
:program:`MPD` process, see :ref:`signals`.
Configuring decoder plugins
---------------------------
...
...
@@ -878,6 +883,7 @@ To auto-start :program:`MPD` upon login, type:
systemctl --user enable mpd
.. _signals:
Signals
-------
...
...
@@ -885,7 +891,8 @@ Signals
:program:`MPD` understands the following UNIX signals:
- ``SIGTERM``, ``SIGINT``: shut down MPD
- ``SIGHUP``: reopen log files (send this after log rotation)
- ``SIGHUP``: reopen log files (send this after log rotation) and
flush caches (see :ref:`input_cache`)
The client
...
...
src/Instance.cxx
View file @
d1cc7377
...
...
@@ -198,3 +198,10 @@ Instance::OnIdle(unsigned flags) noexcept
for
(
auto
&
partition
:
partitions
)
partition
.
EmitIdle
(
flags
);
}
void
Instance
::
FlushCaches
()
noexcept
{
if
(
input_cache
)
input_cache
->
Flush
();
}
src/Instance.hxx
View file @
d1cc7377
...
...
@@ -209,6 +209,8 @@ struct Instance final
}
#endif
void
FlushCaches
()
noexcept
;
private
:
#ifdef ENABLE_DATABASE
/* virtual methods from class DatabaseListener */
...
...
src/unix/SignalHandlers.cxx
View file @
d1cc7377
...
...
@@ -47,10 +47,14 @@ x_sigaction(int signum, const struct sigaction *act)
}
static
void
handle_reload_event
(
void
*
)
noexcept
handle_reload_event
(
void
*
ctx
)
noexcept
{
LogDebug
(
signal_handlers_domain
,
"got SIGHUP, reopening log files"
);
auto
&
instance
=
*
(
Instance
*
)
ctx
;
LogDebug
(
signal_handlers_domain
,
"got SIGHUP, reopening log files and flushing caches"
);
cycle_log_files
();
instance
.
FlushCaches
();
}
#endif
...
...
@@ -73,7 +77,7 @@ SignalHandlersInit(Instance &instance)
SignalMonitorRegister
(
SIGINT
,
{
&
loop
,
HandleShutdownSignal
});
SignalMonitorRegister
(
SIGTERM
,
{
&
loop
,
HandleShutdownSignal
});
SignalMonitorRegister
(
SIGHUP
,
{
nullptr
,
handle_reload_event
});
SignalMonitorRegister
(
SIGHUP
,
{
&
instance
,
handle_reload_event
});
#endif
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment