diff options
| author | 2025-09-28 14:37:07 +0200 | |
|---|---|---|
| committer | 2025-09-28 14:37:07 +0200 | |
| commit | 5d95ffa9f6605fcabdf4bd0e7ac2614cde637127 (patch) | |
| tree | 2f53b7d285c27a81b150fb29b2bc6383a5145289 /data.c | |
| parent | New function actor_failure(). (diff) | |
| download | snac2-5d95ffa9f6605fcabdf4bd0e7ac2614cde637127.tar.gz snac2-5d95ffa9f6605fcabdf4bd0e7ac2614cde637127.tar.xz snac2-5d95ffa9f6605fcabdf4bd0e7ac2614cde637127.zip | |
Revert "New function actor_failure()."
This reverts commit 335b90a9d1654aadb4e0d87114b82685defcd50b.
Diffstat (limited to 'data.c')
| -rw-r--r-- | data.c | 27 |
1 files changed, 9 insertions, 18 deletions
| @@ -3042,13 +3042,18 @@ xs_list *content_search(snac *user, const char *regex, | |||
| 3042 | } | 3042 | } |
| 3043 | 3043 | ||
| 3044 | 3044 | ||
| 3045 | int actor_failure(const char *id, int op) | 3045 | int instance_failure(const char *url, int op) |
| 3046 | /* actor failure maintenance */ | 3046 | /* do some checks and accounting on instance failures */ |
| 3047 | { | 3047 | { |
| 3048 | int ret = 0; | 3048 | int ret = 0; |
| 3049 | xs *l = xs_split(url, "/"); | ||
| 3050 | const char *hostname = xs_list_get(l, 2); | ||
| 3049 | double mt; | 3051 | double mt; |
| 3050 | 3052 | ||
| 3051 | xs *md5 = xs_md5_hex(id, strlen(id)); | 3053 | if (!xs_is_string(hostname)) |
| 3054 | return 0; | ||
| 3055 | |||
| 3056 | xs *md5 = xs_md5_hex(hostname, strlen(hostname)); | ||
| 3052 | xs *fn = xs_fmt("%s/failure/%s", srv_basedir, md5); | 3057 | xs *fn = xs_fmt("%s/failure/%s", srv_basedir, md5); |
| 3053 | 3058 | ||
| 3054 | switch (op) { | 3059 | switch (op) { |
| @@ -3070,7 +3075,7 @@ int actor_failure(const char *id, int op) | |||
| 3070 | 3075 | ||
| 3071 | /* only create once, as the date will be used */ | 3076 | /* only create once, as the date will be used */ |
| 3072 | if ((f = fopen(fn, "w")) != NULL) { | 3077 | if ((f = fopen(fn, "w")) != NULL) { |
| 3073 | fprintf(f, "%s\n", id); | 3078 | fprintf(f, "%s\n", hostname); |
| 3074 | fclose(f); | 3079 | fclose(f); |
| 3075 | } | 3080 | } |
| 3076 | } | 3081 | } |
| @@ -3088,20 +3093,6 @@ int actor_failure(const char *id, int op) | |||
| 3088 | } | 3093 | } |
| 3089 | 3094 | ||
| 3090 | 3095 | ||
| 3091 | int instance_failure(const char *url, int op) | ||
| 3092 | /* instance failure maintenance */ | ||
| 3093 | { | ||
| 3094 | /* extract just the host name */ | ||
| 3095 | xs *l = xs_split(url, "/"); | ||
| 3096 | const char *hostname = xs_list_get(l, 2); | ||
| 3097 | |||
| 3098 | if (!xs_is_string(hostname)) | ||
| 3099 | return 0; | ||
| 3100 | |||
| 3101 | return actor_failure(hostname, op); | ||
| 3102 | } | ||
| 3103 | |||
| 3104 | |||
| 3105 | /** notifications **/ | 3096 | /** notifications **/ |
| 3106 | 3097 | ||
| 3107 | xs_str *notify_check_time(snac *snac, int reset) | 3098 | xs_str *notify_check_time(snac *snac, int reset) |