Midnight Modding Posted June 20, 2018 Posted June 20, 2018 Someone really wants this to be a pm, not notification. I saw from examples on here how to send a PM convo, but me, personally, I think it would be annoying for the sender of the mass PM to have many, many conversations in his/her inbox. 1. Is there an option to use a fake sender? 2. Is there any problem with just simply not calling authorize() for the sender? I don't see anything in that method, other than what is undone by unauthorize(), so I assume I could skip authorize() rather than call both. I originally thought delete() only deleted it for one person, but I see it simply unauthorizes that user and then rebuildParticipants() calls delete() if all participants are gone. ? 3. off topic a tad, but how long does a top priority queued task take to send to x number of members? Is it triggered by site activity like past versions' tasks? Does anyone have an idea of what I should do if the client truly needs some to send out quickly and it will go to potentially hundreds of members? Thanks!
Adriano Faria Posted June 20, 2018 Posted June 20, 2018 4 hours ago, Midnight Modding said: s there an option to use a fake sender? Add only the member who will receive via authorize(). Or add a setting to admin choose a “fake”/bot sender.
Midnight Modding Posted June 20, 2018 Author Posted June 20, 2018 1 minute ago, Adriano Faria said: Add only the member who will receive via authorize(). Thanks., I was just now trying to edit all of this to get to the point that I was really just asking indeed if I could call authorize() only for the receiver. I thought so. I will still edit my first post, to get more simple.
Midnight Modding Posted June 20, 2018 Author Posted June 20, 2018 7 minutes ago, Adriano Faria said: Or add a setting to admin choose a “fake”/bot sender. yeah that may be a good idea, as well. Although, the client does not want them to be able to respond to anyone, anyway, so I might as well just not authorize the sender. (not that it would matter if they do respond to a bot. lol) So now I just need to figure out #3.... and it's going to suck if I do need to change those from queued tasks after I spent so much time setting up my methods in my source file and added many queued tasks.
Nathan Explosion Posted June 20, 2018 Posted June 20, 2018 Item 3 - open your ACP, type tasks into the search and then click on the 'task method' link.
Midnight Modding Posted June 20, 2018 Author Posted June 20, 2018 29 minutes ago, Nathan Explosion said: Item 3 - open your ACP, type tasks into the search and then click on the 'task method' link. Thanks. Well, that explains how they can be run. I've actually never played around with cron, before. I guess that would get it done quickly unless there is a lot of unfinished tasks from when the forum was upgraded... Those could take a long time. And I guess my only other option would be something similar to when an upgrader updates many rows, x number at a time. I'd "rather" keep it as queued tasks, if it can be quick enough for him.
Aiwa Posted June 20, 2018 Posted June 20, 2018 12 hours ago, Midnight Modding said: Someone really wants this to be a pm, not notification. I'll give you fair warning... I've written an app for someone where it started out as a notification, the large quantities of notifications were pruned automatically by an IPS task, worked great. Then they wanted it switched to PM's for a very specific and logical reason. PM's however, are NOT pruned by the system... So if this is a 'notification' that will be frequent in nature, you run the risk of creating an unmanageable mess. You'll need / want a way to identify these PM's and prune them if they are frequent, which isn't exactly easy since the data for a PM is spread across 3 different tables. Make sure both you and your client understand the utility and ramifications of using a notification vs a PM and how it will ultimately impact DB size over time. In my case, approximately 3 million PM's were created within ~1 month. Loading PM's was simply not possible until they were pruned.
Midnight Modding Posted June 20, 2018 Author Posted June 20, 2018 5 hours ago, Aiwa said: I'll give you fair warning... I've written an app for someone where it started out as a notification, the large quantities of notifications were pruned automatically by an IPS task, worked great. Then they wanted it switched to PM's for a very specific and logical reason. PM's however, are NOT pruned by the system... So if this is a 'notification' that will be frequent in nature, you run the risk of creating an unmanageable mess. You'll need / want a way to identify these PM's and prune them if they are frequent, which isn't exactly easy since the data for a PM is spread across 3 different tables. Make sure both you and your client understand the utility and ramifications of using a notification vs a PM and how it will ultimately impact DB size over time. In my case, approximately 3 million PM's were created within ~1 month. Loading PM's was simply not possible until they were pruned. ok thanks. I don't think this feature will be used frequently and it's not one that can be sent to all members on the board, for instance, so it wouldn't build up a lot "too" quickly, but it's something for me to keep in mind on this. Trust me, I'd far rather have not even done a PM feature at all. But the only real alternative would be a notification email, I guess. I guess I could prune only the ones from this one feature... Not sure how I'd go about it. Maybe have a PM sent table with the item id and then after a certain time prune all PMs from that item. (well, delete them, not exactly prune as it wouldn't necessarily be oldest ones). Btw, he really wants this and notifications sent extremely quickly. They're time sensitive, in some cases. I have never done a cron. Is it a situation where still only one task gets run each minute and so a lot of tasks could still cause it to be a while before a particular one gets run? This situation sucks because, as I'm sure you know, customers want everything to be perfect, but there are obviously restraints. Like i said earlier, i could just use soem sort of steps and run them all at the time of the send click, I guess... Oh, also, can you actually run a queued task manually from the acp, to force it to hurry up and finish quicker?
Midnight Modding Posted June 20, 2018 Author Posted June 20, 2018 Also, if the user never goes to their notification settings and click save, no matter what our defaults are, they don't get notifications, right? That's another possible problem. Seems like I recall docs saying you can send an email without it being through the notification system, so that is another option. He says emails may actually be better, anyway. Of course if I did the PM, the notification of new pm could include an email already, as well. Anyway.... so my top concern is how to best send them quickly at this point. We'll figure something out as far as pm vs. email vs. notification. Also, I wonder how high I can safely go on number of notifications or emails or private messages per batch. I was just using IPS default (I think 15?), but surely it could go quite a bit higher with no issue.
Aiwa Posted June 20, 2018 Posted June 20, 2018 TL;DR... You really need to get to the point with some of your posts and not talk yourself in circles... $query = "DELETE FROM core_message_topics, core_message_posts, core_message_topic_user_map USING core_message_topics LEFT JOIN core_message_topic_user_map ON core_message_topics.mt_id=core_message_topic_user_map.map_topic_id LEFT JOIN core_message_posts ON core_message_topics.mt_id=core_message_posts.msg_topic_id WHERE core_message_topics.mt_starter_id=" . \IPS\Settings::i()->fake_user_id . " AND core_message_topics.mt_start_time < " . \IPS\DateTime::create()->sub( new \DateInterval( 'PT' . \IPS\Settings::i()->some_setting_prune_time . 'H' ) )->getTimestamp(); try{ \IPS\Db::i()->query( $query ); }catch( \Exception $e) { return $e; } Not exactly pretty, but if you have a fake user sending PM's and a SINGLE fake user sending these PM's. You can prune them after a set amount of time using the above. 3 tables are impacted, you have to make sure you remove entries from all of them. There is more than likely a built in method to delete PM conversations, but when you're deleting, potentially, millions at a time (in my case)... The above is FAR more efficient.
Midnight Modding Posted June 20, 2018 Author Posted June 20, 2018 Thanks for the code. In this case, I am going in circles because he is wanting it to behave in ways that even first party notifications don't work in. Immediate send to a lot of members, basically forced acceptance of them etc... He thought, as I originally did, that 4.x notifications would have a separate page for each notification, like 3.x did. Them changing that threw a wrench into some of this. SO that is my main concern right now is sending them quickly and if our defaults aren't honored until a user goes and clicks save on the form, then I'd have to use PM or direct email, not involving notifications.
Midnight Modding Posted June 20, 2018 Author Posted June 20, 2018 If I scrap the PM idea totally, and use notification, I'd maybe want to do a check where they can't use the app unless they saved their notification setttings with my keys in it... I assume there's an easy check built in to check one of my keys. (this is if a save of the notification settings form is necessary before anyone can receive them)
Midnight Modding Posted June 21, 2018 Author Posted June 21, 2018 1 hour ago, Adriano Faria said: Use PM and disable Inline in your extension. I've done that before with a different notification, disabled inline where it had to be email. But there's more to this situation that that. Anyway, i think he's decided to just go with a notification now because it actually doesn't need a full blown message, so I had an idea on how to better do it. Main problem now is being sure it sends quickly and also that people are set to get the notification. (most people probably don't go to their settings messing with notifications often).
bfarber Posted June 21, 2018 Posted June 21, 2018 Default settings are used if a user has not specifically saved their notification preferences when a new notification option becomes available. You definitely want to use notifications here, not PMs. That is what the system is for. And if there is a large but variable number of users receiving the notification, you want to use a background queue task as it sounds like you are already doing. If you use cron to run tasks, it will take only a few minutes for the notifications to go out to hundreds of recipients.
Midnight Modding Posted June 21, 2018 Author Posted June 21, 2018 8 hours ago, bfarber said: Default settings are used if a user has not specifically saved their notification preferences when a new notification option becomes available. You definitely want to use notifications here, not PMs. That is what the system is for. And if there is a large but variable number of users receiving the notification, you want to use a background queue task as it sounds like you are already doing. If you use cron to run tasks, it will take only a few minutes for the notifications to go out to hundreds of recipients. Thanks. I hated to do it as a PM all along and luckily now he agrees with doing it with a notification. The problem was that originally it was going to be related to a potentially long message (I thought, anyway). But, even in that case, we could have done a short inline notification and long email from the notification.
Midnight Modding Posted June 22, 2018 Author Posted June 22, 2018 Forgot to ask if anyone has opinions on a good number to send per batch, whether it be notifications or private messages (in case I ever do use a PM feature). Mostly, the only input I've been given in the past on it is that it would depend on the particular server and maybe I could put a setting in acp for them to change the number around. But of course then if they put it too high, they'll have a problem... For now I just left it at the default IPS usually uses.... that constant.... which I think is 15, IIRC?
Aiwa Posted June 22, 2018 Posted June 22, 2018 If you make it a setting, and the admin puts it too high, their issue. You can also add form validation so you can't exceed a set number.
Midnight Modding Posted June 23, 2018 Author Posted June 23, 2018 10 hours ago, Aiwa said: If you make it a setting, and the admin puts it too high, their issue. You can also add form validation so you can't exceed a set number. Do you have a suggestion for what I should use as a max if I do it this way? I honestly think in 3.x it sent hundreds at a time fine, but I don't know how much more is going on in 4.x.
Recommended Posts
Archived
This topic is now archived and is closed to further replies.