mirror of
https://github.com/haiwen/seafile-server.git
synced 2025-09-13 13:51:53 +00:00
add ctime
This commit is contained in:
@@ -24,7 +24,7 @@ static GAsyncQueue *
|
||||
seaf_mq_manager_channel_new (SeafMqManager *mgr, const char *channel)
|
||||
{
|
||||
GAsyncQueue *async_queue = NULL;
|
||||
async_queue = g_async_queue_new_full ((GDestroyNotify)g_free);
|
||||
async_queue = g_async_queue_new_full ((GDestroyNotify)json_decref);
|
||||
|
||||
g_hash_table_replace (mgr->priv->chans, g_strdup (channel), async_queue);
|
||||
|
||||
@@ -51,12 +51,15 @@ seaf_mq_manager_publish_event (SeafMqManager *mgr, const char *channel, const ch
|
||||
return -1;
|
||||
}
|
||||
|
||||
g_async_queue_push (async_queue, g_strdup (content));
|
||||
json_t *msg = json_object();
|
||||
json_object_set_new (msg, "content", json_string(content));
|
||||
json_object_set_new (msg, "ctime", json_integer(time(NULL)));
|
||||
g_async_queue_push (async_queue, msg);
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
char *
|
||||
json_t *
|
||||
seaf_mq_manager_pop_event (SeafMqManager *mgr, const char *channel)
|
||||
{
|
||||
GAsyncQueue *async_queue = g_hash_table_lookup (mgr->priv->chans, channel);
|
||||
|
@@ -16,7 +16,7 @@ seaf_mq_manager_new ();
|
||||
int
|
||||
seaf_mq_manager_publish_event (SeafMqManager *mgr, const char *channel, const char *content);
|
||||
|
||||
char *
|
||||
json_t *
|
||||
seaf_mq_manager_pop_event (SeafMqManager *mgr, const char *channel);
|
||||
|
||||
#endif
|
||||
|
@@ -250,7 +250,7 @@ seafile_publish_event(const char *channel, const char *content, GError **error)
|
||||
return ret;
|
||||
}
|
||||
|
||||
char*
|
||||
json_t *
|
||||
seafile_pop_event(const char *channel, GError **error)
|
||||
{
|
||||
if (!channel) {
|
||||
|
@@ -1125,6 +1125,6 @@ seafile_get_repo_status(const char *repo_id, GError **error);
|
||||
int
|
||||
seafile_publish_event(const char *channel, const char *content, GError **error);
|
||||
|
||||
char*
|
||||
json_t *
|
||||
seafile_pop_event(const char *channel, GError **error);
|
||||
#endif
|
||||
|
@@ -102,4 +102,5 @@ func_table = [
|
||||
[ "object", ["string", "string", "string", "int"] ],
|
||||
[ "object", ["string", "string", "string", "string", "string", "string", "string", "int", "int"] ],
|
||||
[ "object", ["string", "string", "string", "string", "string", "string", "int", "string", "int", "int"] ],
|
||||
["json", ["string"]],
|
||||
]
|
||||
|
@@ -795,7 +795,7 @@ class SeafServerThreadedRpcClient(NamedPipeClient):
|
||||
def publish_event(channel, content):
|
||||
pass
|
||||
|
||||
@searpc_func("string", ["string"])
|
||||
@searpc_func("json", ["string"])
|
||||
def pop_event(channel):
|
||||
pass
|
||||
|
||||
|
@@ -640,7 +640,7 @@ static void start_rpc_service (const char *seafile_dir)
|
||||
searpc_server_register_function ("seafserv-threaded-rpcserver",
|
||||
seafile_pop_event,
|
||||
"pop_event",
|
||||
searpc_signature_string__string());
|
||||
searpc_signature_json__string());
|
||||
|
||||
|
||||
searpc_server_register_function ("seafserv-threaded-rpcserver",
|
||||
|
Reference in New Issue
Block a user